Why are developers so fond of ‘REUSE_ALV_GRID_DISPLAY’?

Share on Facebook4Share on LinkedIn3Tweet about this on TwitterShare on Google+0
Please Share!!

Is it that difficult to NOT use FM ‘REUSE_ALV_GRID_DISPLAY’ to display ALV? Or is it human nature to stay in our comfort zone? ABAPers who are addicted to this FM, have the code snippet ready in their repository to reuse in every other report, so they do not care to look for any other alternative.

[adToAppearHere]

SAP released the class ‘CL_SALV_TABLE’ more than a decade ago but still it could not reach the minds of most of those FM loving ABAPers. SAP has different other classes to display the ALV but factory method is one of the simplest to implement. In fact, I find factory method takes even less lines of code than the popular ‘REUSE_ALV_GRID_DISPLAY’.

Internet is flooded with tutorials of how to use this class ‘CL_SALV_TABLE’ for ALV display. So I do not want to add another tutorial. In this post, I would simply provide the working code snippet which can be used in any project. Hope with this ready made solution, some old school ABAPers would take a dip in this class method to display the ALV.. 🙂

Also Read: 4 Versions of the same program to understand OOPs ABAP.

Declare a method in your report class with the below code passing your final internal table ( for beginner you can copy it into a subroutine and call it in your program).

Save this code snippet and start reusing it with confidence.. 😛

If you do not want to display certain fields of the final table, we can set it to invisible.

Please let us know, if we need to provide further clarification on this topic.

Also Read: How to convert an existing ABAP Report to OOPs Report.

 

Image source: via Free Stock Photos foter.com

Share on Facebook4Share on LinkedIn3Tweet about this on TwitterShare on Google+0
Please Share!!

About the Author

SAP Yard
SAP Yard
SAPYard is one stop page for all Technical Folks in SAP. You would find un-conventional explanations, tutorials, and tricks. Please like our Facebook Page and also join our LinkedIn Group.

1 Comment on "Why are developers so fond of ‘REUSE_ALV_GRID_DISPLAY’?"

  1. Hi ! I have a requirement where data has to be printed across pages using a page break.To achieve this , I have coded just as described above by using the ‘GROUP_WITH_NEWPAGE’ setting in the ‘add_sort’ method.However i noticed that the sorting/grouping doesn’t work when a layout is selected on the selection screen.It looks like the layout settings are overwriting my sort feature.Any suggestions how to overcome this?

Comments are closed.