To create the layout a page header individually, you must define it in the processing block after the event keyword TOP-OF-PAGE:
TOP-OF-PAGE.
WRITE:
....
The TOP-OF-PAGE event occurs as soon as the system starts processing a new page of a list. The system processes the statements following TOP-OF-PAGE before outputting the first line on a new page. For information on events and processing blocks, see Controlling the Flow of ABAP Programs by Events.
Remember to end the processing block following TOP-OF-PAGE by specifying an appropriate event keyword – for example, START-OF-SELECTION – if you want to start processing the actual list afterwards (see Defining Processing Blocks).
The self-defined page header appears beneath the standard page header. If you want to suppress the standard page header, use the NO STANDARD PAGE HEADING option of the REPORT statement:
REPORT rep NO STANDARD PAGE HEADING.
When you use this statement, the system does not display a standard page header on the pages of a list of program rep. If you have defined an individual page header using TOP-OF-PAGE, the system displays it.
During the event TOP-OF-PAGE, you can also fill the system fields sy-tvar0 through sy-tvar9 with values that should replace possible placeholders &0 to &9 in the standard page header.
When you scroll vertically, the self-defined page header remains visible as does the standard page header. However, the self-defined page header consists of normal list lines and therefore does not adapt automatically to the window width.
REPORT demo_list_page_heading NO STANDARD PAGE HEADING.
TOP-OF-PAGE.
WRITE: sy-title, 40 'Page', sy-pagno.
ULINE.
WRITE: / 'SAP AG', 29 'Walldorf,
',sy-datum,
/ 'Neurottstr. 16', / '69190 Walldorf/Baden'.
ULINE.
START-OF-SELECTION.
DO 5 TIMES.
WRITE /
sy-index.
ENDDO.
This program does not use the standard page header, but one that is self-defined following TOP-OF-PAGE. It is necessary to specify the event keyword START-OF-SELECTION to implicitly end the TOP-OF-PAGE processing block. The output appears as follows:
The self-defined page header consists of six lines. The program title comes from the sy-title system field, the page number from sy-pagno. The self-defined page header is not as wide as the list.