In Web Dynpro ABAP you can use Service calls, Service call is the services provided by the model layer of the WDA Application this is kind of custom controller or component.
We will explain how to use service call in Web Dynpro ABAP to call ALV Grid for displaying data.
1.Go to transaction SE80 and create Web Dynpro Intf/Comp
2.In the second step you need to create context first, this sample we want to display Sales Header data from table VBAK.
Create Function module with parameter is same with context attributes. this function module we will use in the service call.
3.Right clicking on your web dynpro component, and select Create->Service Call.
3.After you click on menu Create->Service call, the Wizard screen will open up. on the second wizard screen, select Use Existent Controller because in this example we dont want create new controller.
4. On the next wizard screen, SAP System provide us with 4 option : Function module, Assistance Class Method, Class Method and Web Service Proxy. In this example we choose Function Module.
5.Enter your function module which you’ve created. In this wizard screen, you need to change Obj Type in your function module parameter from Controller Attribute into Context Node/Attribute.
Click button Continue, the next screen SAP System will generate method automatically. just click Next and complete
6.After finish process, you will see new context node with Importing and Changing as picture below.
7.Now go to MAIN View and drag importing context node to context view.
8. Go to Layout tab in MAIN View and create UI Element Input Field, This layout consist of Label Element, Input Field, Horizontal Gutter for Separation, and ViewContainer ( ALV Table ).
Next create Action GETDATA for Button Get Data.
9. Go to Action tab, double click on GETDATA Action and write ABAP Code. This ABAP Code will call function module in Service Call.
METHOD onactiongetdata .
10. Back to Layout tab and click on INP_VKORG ( Input Field ), you need to bind this UI Element to Context View.
11. Add Component SALV_WD_TABLE and enter ALV_TABLE ( UI ViewContainer name ) into Component Use field.