SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → User Dialogs → Classic Lists → Processing Lists in the List Buffer →Syntax
SCROLL LIST [horizontal]
[vertical]
[INDEX idx].
Addition:
Effect
This statement scrolls the display area of a list stored in the list buffer to the position specified in horizontal and/or vertical. At least one of these additions must be specified, in which all horizontal specifications refer to the columns of a displayed list. The corresponding section is displayed when the list is next displayed.
Without using the statement SCROLL, the system displays a list during the
initial display, starting from the first column of the first row. If the user navigates from a details
list back to a lower list level, the list is displayed with the section in which it was last displayed.
The SCROLL statement sets a new first column, a new first row, or both. Each
SCROLL statement sets only the size specified in it, without changing the other positions.
... INDEX idx
Effect
The list level can be specified with the addition INDEX, where a data object
(which contains the list index) of type i is expected for idx.
The value of idx must be greater than or equal to 0. If the addition
INDEX is not specified, then the list level 0 (the basic list itself) is selected during the creation of the basic list, and the list level at which the event was triggered
(sy-listi) is selected during the processing of a list event. If the list level specified in idx is not available,
sy-subrc is set to the value 8.
System Fields
sy-subrc | Meaning |
0 | Screen section was scrolled. |
4 | Complete scrolling not possible because the list margin was reached. |
8 | Scrolling not possible because the specified list level does not exist. |
Note
While scrolling through the list that is being created
(sy-lsind), remember that a SCROLL statement has no effect prior to the first output statement, since the list does not yet exist in the list buffer.
Example
By double-clicking the basic list, you can scroll down this list in the AT LINE-SELECTION event block to the page entered in a selection screen. The lines on the page retain their original position with reference to the page header by using sy-staro. However, you do not need to explicitly set the column to sy-staco, since this position is retained during vertical scrolling.
REPORT LINE-COUNT 100 LINE-SIZE 100
NO STANDARD PAGE HEADING.
SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW.
PARAMETERS page TYPE i.
SELECTION-SCREEN END OF SCREEN 500.
START-OF-SELECTION.
DO 10000 TIMES.
WRITE sy-index.
ENDDO.
TOP-OF-PAGE.
ULINE.
WRITE sy-pagno.
ULINE.
AT LINE-SELECTION.
CALL SELECTION-SCREEN 500 STARTING AT 10 10.
SCROLL LIST TO COLUMN sy-staco
TO PAGE page LINE sy-staro.