首页 > SAP > ABAP > Create an ALV report using CL_GUI_ALV_GRID
2019
08-29

Create an ALV report using CL_GUI_ALV_GRID

[adsenseyu2]

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-ABAP编辑器 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.

Create an ALV report using CL_GUI_ALV_GRID - 第2张  | 优通SAP
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.

[adsenseyu1]

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.

Source Code:

https://gist.github.com/prakash13t/81bbfda02c5ced71657c#file-alv_gui-abap

Output:

OOP ALV report

最后编辑:
作者:yangsen
本站为个人博客网站,全由我个人维护,我从事SAP开发13年,其它ERP开发7年,基本都是零售行业。本站记录工作学习的过程, 有SAP相关询问专、兼职工作可随时联系我。 有网站相关的问题可直接在文章下方留言,或者联系我。 邮件:yan252@163.com给我。 QQ:415402519