You can call an existing functional module in a Web Dynpro component using a service call. To create a service call, you can use easy-to-use wizard in Web Dynpro tools.
You can launch the wizard in ABAP workbench to create a service call.
Run T-Code − SE80
Step 1 − Select Web Dynpro component → Right-click to open the context menu. Go to create → Service call.
It will open Web Dynpro wizard − Start screen.
Step 2 − You can select if you want service call to be embedded in an existing controller or you want to create a new controller.
Note − The service calls should be embedded in global controllers and it can’t be used with the view controllers in Web Dynpro.
Step 3 − In the next window, select the service type. Click the Continue button.
Step 4 − In the next window, select a function module as a service. You can use the input help for this.
If you choose a remote capable function module, you can optionally specify an RFC destination that is to be used when calling the function module. If you do not specify a destination, the function module will be called locally.
Note − The function module must exist in the current system! The wizard does not support to call a remote capable function module that does not exist in the current system.
Step 5 − Click Continue.
Step 6 − In the next window, you can choose which object type to use to represent the service function parameters in Web Dynpro controller −
To do this, select the required object type from the list box in the relevant lines.
Note − Only UI-relevant data should be stored in the context.
You can also individually name the controller attributes and the context nodes to be created.
The following proposal is generated −
The root node receives the name of the service.
The nodes for grouping the parameters according to their declaration types receive appropriate names such as IMPORTING, EXPORTING, ...
The node names and attribute names for the parameters themselves are identical to the parameter names.
As the length of the node and the attribute names is limited to 20 characters, they are abbreviated accordingly, if necessary.
In the next window, selected service uses types from type groups as parameter types and/or defines implicit table parameters.
For all the types listed below, define (table) types with the same equal structure in the Data Dictionary. These will then be used for typing of controller attributes or method parameters created by the wizard.
Step 7 − Enter Attribute Type − TEST and click Continue.
Step 8 − In the next window, specify the name of the method that should execute the service. The wizard generates coding for calling the service and for the context binding.
The method must not yet exist in the controller.
You have now entered all the necessary information for the creation of the model-oriented controller.
Step 9 − Click ‘Complete’ to create the controller, or enhance it respectively, to generate the service call.
You can also cancel the wizard at this position. However, data entered before are lost.