Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member188685
Active Contributor

I have noticed that there are many open threads regarding a single topic within the ABAP Development therefore I decided to gather them all up and write a blog with the solution.

This Blog explains how to trigger the TOP_OF_PAGE event in an ALV Report using CL_GUI_ALV_GRID class. I developed a small report and implemented the TOP_OF_PAGE event of CL_GUI_ALV_GRID class, TOP_OF_PAGE event uses the object of class CL_DD_DOCUMENT. In this class there are methods ADD_TEXT, ADD_PICTURE, and ADD_GAP which are useful to to show the contenet in the TOP_OF_PAGE. One important thing is to split the screen into two parts using the splitter container and then use the first part to TOP_OF_PAGE and the second one to show the Grid data. Here is the Simple Report with the Steps. 1.Create the Screen 100, and place the Custom Control in the Screen and Name it as CONTROL. 2.Using the PBO Module set the PF-status and Title Bar

3.Split the Container and Assign the first part to TOP_OF_PAGE and second part to ALV GRID.

4.Have a local class inside the report to Handle the TOP_OF_PAGE event.
Create the Event Handler Object and Set the handler to trigger the TOP_OF_PAGE event. CREATE OBJECT G_GRID
EXPORTING I_PARENT = O_PARENT_GRID.
DATA:G_HANDLER TYPE REF TO LCL_EVENT_HANDLER.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
5. Use of methods ADD_TEXT, ADD_PICTURE, ADD_GAP, etc. ADD_TEXT is used to add the text and also you can specify the color,font size,font type. So many friends asked in the forum I want to place the text right aligned instead of left this also can be done with the combination of ADD_TEXT and ADD_GAP, but this is not possible with the ALV FM's. ADD_PICTURE is used to Add the Logo in the Top of page.Incase of ALV Grid(using FM) the Logo always on Right side.But here you can place where you want. ADD_GAP is used to add the Gap,It can take the paramter width, with that parameter you can maintain the gap between two texts. NEW_LINE is add the New line where ever required. 6.Check the sample output of the Report.
7. The complete coding

26 Comments