In this tutorial, we will learn how to create an basic ABAP ALV report using the object oriented approach. Standard class CL_GUI_ALV_GRID is used to built the ALV report in ABAP. Lets see a step-to-step guide to create an OOP ABAP ALV report.
1. Create an executable program in SE38 and copy & past the below code at the end of this tutorial.
2. Define a local class LCL_SFLIGHT in the program, declare the types and data that are required to display the data in ALV report.
3. Create a screen 100 in the program. You can give screen number of your choice.
4. Add custom container in the Layout of the screen.
5. Create a method call it as GET_SFLIGHT_DATA to get the data from the table SFLIGHT using SELECT query.
6. Create a method call it as BUILD_FIELDCATLOG to build ALV report fieldcatlog which is mandatory to dislpay ALV.
7. Create a method call it is DISPLAY_ALV to call the custom screen 100 created above.
8. Create a instance of the local class LC_SFLIGHT and call the methods GET_SFLIGHT_DATA and BUILD_FIELDCATLOG.
9. Create custom container instance by providing the name of the container that we created in the above step.
10. Create ALV Grid instance by providing the the custom container instance.
11. Call the method SET_TABLE_FOR_FIRST_DISPLAY( ) to call the ALV report.
12. Call the method DISPLAY_ALV to display the ALV report.