Reusability of components in Web Dynpro for ABAP


Declare and Configure View Controller and Interface Controller:

Before you can call the Interface Controller method of the used component you have to declare that the view controller can use the Interface Controller of the used component. By default only the component controller can access used components directly, view controllers have to specify this explicitly. Therefore go to the tab Properties of the SEARCH, click the button Create Controller Use and select the INTERFACECONTROLLER of the FLIGHTS component use.  


Now go to methods tab of SEARCH view and implement the method ONACTIONSEARCH.

To get the flights information based on input information we will write below code.

 First we need Carrier Id and Connection Id then we will pass these values to Method GET_FLIGHT_DETAILS of used component ZDEMO_FLIGHTS to retrieve the flights details. To get the value of the Context node SEARCH use code wizard of  Application tool bar.

Select Read Context Node/Attribute and click the input help (1). Select SEARCH (2) node in the appearing context viewer. 


The wizard will generate the necessary coding to get the carrier id and connection id from the input fields and stores it in a structure STRU_SEARCH.


Position the cursor at the end of the generated code and call the code wizard again to generate the coding to call the Interface Controller method. Choose Method Call in Used Controller (1) Select the INTERFACECONTROLLER of the used component (2) Select the input help of the Method input field (3) and choose the GET_FLIGHT_DETAILS method (4)


The wizard will generate the coding for calling the Interface Controller’s GET_FLIGHT_DETAILS method and pass the parameters to the method.



Activation, Creation of a Web Dynpro Application and Execution:

1. Activate all objects of Web Dynpro component ZDEMO_SEARCH_FLIGHTS.

2. Click on the Web Dynpro component ZDEMO_SEARCH_FLIGHTS in the object tree and open the context menu to create a new application.

3. Test the Application. 


The result of the application is like:


Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image