Create an ALV report using CL_GUI_ALV_GRID

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.

Custom screen in ALV

4. Add custom container in the Layout of the screen.

Custom Container

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.