To scroll a list by pages, that is, scroll vertically depending on the page length, the SCROLL statement offers several options.
To scroll to specific pages, use the TO option of the SCROLLstatement:
SCROLL LIST TO FIRST PAGE|LAST
PAGE|PAGE pag
[INDEX idx] [LINE lin].
If you do not use the INDEX addition, the statement scrolls in the current list to the first page, last page or to the page with page number pag. If you use the INDEX option, the system scrolls in the list with the level idx. For more information on list levels, see Interactive Lists.
If you specify the LINE option, the system displays the page to which it scrolls starting from line lin of the actual list. It does not count the page header lines.
To scroll a list by a specific number of pages, use the following options of the SCROLL statement:
SCROLL LIST FORWARD|BACKWARD n PAGES [INDEX idx].
If you do not specify the INDEX option, the statement scrolls forward or backward n pages. The INDEX option specifies a particular list level as described above.
REPORT demo_list_scroll_2 NO STANDARD PAGE HEADING
LINE-SIZE
40 LINE-COUNT 8(2).
DATA: pag TYPE i VALUE 15,
lin TYPE i VALUE 4.
TOP-OF-PAGE.
WRITE: 'Top of Page', sy-pagno.
ULINE.
END-OF-PAGE.
ULINE.
WRITE: 'End of Page',
sy-pagno.
START-OF-SELECTION.
DO 100 TIMES.
DO 4 TIMES.
WRITE /
sy-index.
ENDDO.
ENDDO.
SCROLL LIST TO PAGE pag LINE lin.
This program creates a list of 100 pages with 8 lines per page. On each page, four lines are used for page header and page footer. Due to the SCROLL statement, the output of the program appears as follows:
The list display starts at page 15. Due to the LINE option, the first three lines of the actual list are scrolled beneath the page header.