Show TOC

Background documentationScrolling by Pages Locate this document in the navigation structure

 

To scroll a list by pages, that is, scroll vertically depending on the page length, the SCROLL statement offers several options.

Scrolling to Specific Pages

To scroll to specific pages, use the TO option of the SCROLL statement:

Syntax Syntax

  1. SCROLL LIST TO FIRST PAGE|LAST PAGE|PAGE pag  
  2.                [INDEX idx] [LINE lin].
End of the source code.

Without the INDEX option, the statement scrolls the current list to the first page, last page, or the page numbered pag. If you specify the INDEX option, the system scrolls the list of list 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.

Scrolling by a Specific Number of Pages

To scroll a list by a specific number of pages, use the following options of the SCROLL statement:

Syntax Syntax

  1. SCROLL LIST FORWARD|BACKWARD n PAGES [INDEX idx].
End of the source code.

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.

Syntax Syntax

  1. REPORT demo_list_scroll_2 NO STANDARD PAGE HEADING
  2.                           LINE-SIZE 40 LINE-COUNT 8(2).
    DATA: pag TYPE i VALUE 15,
  3.       lin TYPE i VALUE 4.
    TOP-OF-PAGE.
      WRITE: 'Top of Page', sy-pagno.
  4.   ULINE.
    END-OF-PAGE.
      ULINE.
  5.   WRITE: 'End of Page', sy-pagno.
    START-OF-SELECTION.
      DO 100 TIMES.
  6.     DO 4 TIMES.
  7.       WRITE / sy-index.
  8.     ENDDO.
  9.   ENDDO.
  10.   SCROLL LIST TO PAGE pag LINE lin.
    
End of the source code.

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:

This graphic is explained in the accompanying text.

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.