A service call has been created in accordance with the procedure laid out in the previous chapter.
The use of a service call is in no way different from the use of a manually created method of the controller. The procedure for automatic creation by the wizard creates – in addition to the required context nodes and attributes – solely a method in a cross-view controller. This method takes on the job of calling the service. This will be demonstrated here using a simple example:
You wish to read data from a database table and display it in a view with the help of an existing function module. For this purpose, you have created a service call for the function module in your Web Dynpro component. The global controller that you have chosen or created during the creation procedure now contains the required context nodes and attributes as well as a method for calling the function module.
The method EXECUTE_FUNCMODULE1 was already programmed automatically.
The function module is now available to the component. Now it is possible to choose a view in order to display the elements of the database table in the browser. Provided the global controller is not the component controller, a use of the global controller must be entered for the controller of the selected view. Afterwards, mapping of the node FUNCMODUL1 onto the node with the same name in a view controller context is generated.
Now, to fill the context node FUNCMODUL1 of the view controller context with the data of the database table, the method EXECUTE_FUNCMODULE1 of the global controller is called it its supply function. For this purpose you must create such a supply function by calling the method EXECUTE_FUNCMODULE1 . (Refer also to the chapter Web Dynpro Code Wizard, Calling Methods in the Used Controller).