Entering content frame

Scrolling in Detail Lists Locate the document in its SAP Library structure

You use SCROLL statement to scroll in a detail list. The Scrolling in Lists section contains a full description of the statement and how to use it for basic lists.

When you use the SCROLL statement with detail lists, you must remember the following:

        You can only use the SCROLLstatement for completed lists. If you place this statement before the first output statement of a list, it does not affect this list. If you place it after the first output statement of a list, it affects the entire list, that is, all subsequent output statements as well.

        When you create a secondary list, a SCROLLstatement without the INDEX option always refers to the previously displayed list on which the interactive event occurred (index sy-listi).

        The SCROLLstatement only refers to the list currently being created while the basic list is actually being created.

        You can use the INDEXaddition to scroll explicitly on existing list levels. To do this, the lists do not need to be displayed. When the user displays the list again, it is scrolled to the specified position. If the specified list level does not exist, the system sets sy-subrc to 8.

        If, during an interactive event, you want to scroll through the list you are currently creating, use sy-lsind as the index in the SCROLL statement. Note that changing sy-lsind only takes effect at the end of the event, regardless of where you change it in the processing block. If you want to set the list level explicitly, you can change sy-lsind in the last statement of the processing block. This ensures that a SCROLLstatement within the processing block accesses the correct list.

Another way of scrolling interactive lists from within the program is to use the SET USER COMMAND statement in conjunction with the corresponding predefined function codes (P...).

Example

REPORT demo_list_scroll NO STANDARD PAGE HEADING LINE-SIZE 50.

SET PF-STATUS 'SELECT'.

WRITE 'Create a secondary list by choosing SELECT'.

AT USER-COMMAND.
  NEW-PAGE LINE-SIZE 200.
  CASE sy-ucomm.
    WHEN 'SELE'.
      SET PF-STATUS 'SCROLLING'.
      DO 200 TIMES. WRITE sy-index. ENDDO.
      SCROLL LIST RIGHT BY 48 PLACES INDEX sy-lsind.
      sy-lsind = sy-lsind - 1.
    WHEN 'LEFT'.
      SCROLL LIST LEFT BY 12 PLACES.
    WHEN 'RGHT'.
      SCROLL LIST RIGHT BY 12 PLACES.
  ENDCASE.

This program creates a basic list of one line with the status SELECT. In the SELECT status, the function SELE (text SELECT) is assigned to the function key F2 and to a pushbutton in the application toolbar.

After choosing SELECT, the system triggers the AT USER-COMMAND event and creates a detail list with status SCROLLING. In the status SCROLLING, the function codes LEFT (text LEFT) und RGTH (text RIGHT) are assigned to the function keys F5 and F6 and to the application toolbar. The detail list is 200 characters wide. The SCROLL statement scrolls the detail list (sy-lsind = 1) by 48 columns to the right after it has been created. sy-lsind is then decreased by one, and the scrolled list replaces the basic list.

By clicking on LEFT and RIGHT, the user can scroll to the left and to the right in the displayed list. The SCROLL statements are programmed for the corresponding function codes within the AT USER-COMMAND event.

 

 

 

 

 

Leaving content frame