Top of page event in sap abap example

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.

when the first write statements is occuring that time top of page event is triggered.regardsbala

initially when start-of-selection statements executes then top-of-page executes.
Whenever one write statement is executed
Top-of-page event occurs when it notices the first u-line or write statement in a program.
top-of-page gets triggered when it see first write statement or new page
when it finds.. first Write , Skip , Uline statement ... then Top of page event will trigger.
top-of-page event is triggered when a write, uline or skip statements are encountered for the first time.
TOP-OF-PAGE is a list processing event which is executed before the first data is output on a new page. i.e. first write: statement
When write statement iswritten under top-of-page. It is important to specify the line-count after report program < name >
top_of_page event is triggered as soon as the system starts processing the new page of the list i.e. before outputting the first line on the new page.... this is the only correct answer....thanks anish garg
Whenever the first out-put (write, skip, uline) statement occurs then the top-of-page will be triggred.
Top of page event is triggered when there is a first write statement occurred in the reports. If there is a selection screen there then Top of page event occurred twice. when there is write statement called in the reports before selection screen and after selection screen processed.
It executes before the first data is output on a new page

Parmar Mahipalsinh Udesinh

  • May 4th, 2012
TOP-OF-PAGE is a list processing event which is executed before the the first data is output on a new page. Notes Without the addition … DURING LINE-SELECTION , TOP-OF-PAGE is processed only when generating basic lists, not when creating secondary lists. TOP-OF-PAGE allows you to define output which supplements the standard page header at the beginning of the page or. Alternatively, if the standard page header is suppressed (with (REPORT … NO STANDARD PAGE HEADING. ), it allows you to design your own page header. TOP-OF-PAGE is only executed before outputting the first line on a new page. It is not triggered by a NEW-PAGE statement

srinivasaraju.vyasyaraju

  • May 9th, 2012
After complete start-of-selection top-of-page will triggered.
TOP-OF-PAGE will be trigger after first WRITE statement.

srinivasaraju.vysyaraju

  • Jun 6th, 2012

saimahesh gelivi
  • Jun 18th, 2012
  • top_of_page is one of the event in ALV reports..it is triggered at the top of each page(may contain secondary pages)..i.e...output of each and every list.

    Keshav Saxena

    • Jun 29th, 2012
    Top of page event is triggerd after the execution of very first write statement.

    Sadeq Ahmed

    • Sep 26th, 2012
    top-of-page event will triggered whenever first write statement or first skip statement triggers.
    It triggers before first data is output on new page.

    somanath.g

    • Aug 11th, 2014
    Top-of-page is an event in classical report which is triggered at the top of each page.
    Top of page triggers at the very first Write statement
    Top of page will trigger only when any new page is opened for printing in report, other wise it will not print any thing if we use only top of page event in the program
    This event is executed before the first data is output of a new page, It processes a basic list using some output statements like WRITE, ULINE etc. But it is not triggered by NEW PAGE statement.

    ramasundari

    • Nov 4th, 2015

    Top of page is triggered before new page is processed and before first write statement in start-of-selection

    What is top

    TOP-OF-PAGE - ABAP Keyword Documentation. TOP-OF-PAGE [DURING LINE-SELECTION]. This statement defines an event block whose event is raised by the ABAP runtime environment when a list is created. This occurs when a new page begins (that is, immediately before the first line on a new page is produced).

    How do I add a top page in ALV?

    In order to insert a report heading in to the ALV grid you need to perform the following steps:.

    Update 'REUSE_ALV_GRID_DISPLAY' FM call to include 'TOP-OF-PAGE' FORM..

    Create 'TOP-OF-PAGE' FORM – Using 'REUSE_ALV_COMMENTARY_WRITE' inside TOP-OF-PAGE subroutine..

    What is the use of top include in SAP?

    The top include can contain only declarative statements and is respected when individual include programs of a program are compiled. In Repository Browser (a part of Object Navigator in ABAP Workbench), the INCLUDE programs bound by a program are executed as the subnodes of the program.

    What is the end of page event?

    The END-OF-PAGE event is executed whenever processing reaches that area when formatting a list page or if the RESERVE statement detects that there is insufficient space remaining on the current page.