Show TOC

TOP-OF-PAGE CodeLocate this document in the navigation structure


The TOP-OF-PAGE code is copied into every generated report and appears at TOP-OF-PAGE just before the instructions for output of the page header. If this code includes WRITE statements, then the output will appear in the list before the page header that is created by the query. If the list is printed with a standard page header, then the output appears between the standard page header and the page header created by the query. You should note that these additions to the output cannot be displayed by the layout display in the query maintenance component.


When outputting using the SAP List Viewer, the code at TOP-OF-PAGE has no significance.

The TOP-OF-PAGE code is maintained by selecting the symbol Code.. Any ABAP statements may be used in the code. Any data objects may be accessed. However, it is better to restrict to the following objects:

  • Parameters from the InfoSet and the logical database

  • Selection criteria for the InfoSet and the logical database

  • Global data from the DATA code

Fields in logical database tables or additional tables and additional fields do not have a defined value at this point.

The %HEAD variable can be used to specify which page header should be output. This variable is available in the standard settings and takes one of the following values:


Output at END-OF-SELECTION (before the list is output)


Output the basic list


Output the statistics xx (xx=01-99)


Output the ranked list xx (xx=01-99)


Output the conversion table


Output at END-OF-SELECTION (after the list is output)

The value of the %HEAD variable may be queried but may not be changed, since it is an internal runtime system variable.

The use of TOP-OF-PAGE code allows the standard page header to be extended. However, it is important to note that if this is done then the changes will take effect on all queries that work with this functional area.