Friday 18 July 2014

Using checkbox in ALV Webdynpro with Messaging functionality

Requirement: Creation of ALV with Check box and messaging functionality

Prerequisite: Creation of simple Webdynpro ALV application.

Steps:

1. Create a webdynpro component.
2. In main screen in 'used component' tab create the component usage of the standard ALV component SALV_WD_TABLE.


3. Go to component controller and create the component usage here also by clicking on the button as below. It will show the component usage you have created earlier. Use this one and screen will look like the 2nd screen shot.






4. Go to context tab of component controller and create 3 nodes named Header, Item, select_option. Make their attribute as mentioned below.







As you can see in right hand side panel, there is the context of component SALV_WD_TABLE. If you check in that component, the context shown here in right hand side, are actually the interface nodes of SALV_WD_TABLE. This way interface node come to the custom component where they are used.

5. Create a structure named ZHEADER1 in SE11 like below. And create a table type Z_HEADER
where line type is ZHEADER1.


These structure and table type we are going to sue further in our coding.

6. Create 2 attributes in attribute tab of component controller like below.





7. Create the layout of main view like below.


8. Go into the window where main view is embed. Inside main window you will get to see the view container you have created in main view's layout. Right click on it and click on 'embed view'. There select the 'Table' view of the used component. The window tab will kook like this now.




9. Go to INTERFACECONTROLLER in component usage. There bind the HEADER node of component controller to  DATA node of interface controller




10. In MAIN view on display button, create an event on action named 'ONDISPLAY'. By doing this there would be one method created automatically in method tab of the view like below.



11. Our job now is to fill the internal table and then the HEADER context node in order to display it in ALV. For that, in ONACTIONDISPLAY method we will right the below code.











12. Now go to the method tab of main view. There create one event handler method named ONCLICK. In event column select ON_CELL_ACTION event of interface controller of component usage ALV_USAGE.




13. Going inside the code of ONCLICK method, you will find one parameter named R_PARAM. This parameter will have the required info to process the checked row. This parameter will have data ranging from index of checked table record, column name, column value and all.

14.  We are implementing the functionality of displaying information message on check /uncheck of
check box and displaying the information message containing the index of table row. Below code is used for that. That is very well using the R_PARAM parameter of the method.




Results:





                                                                                                             By: Reetika Patel


No comments:

Post a Comment