SCROLL is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details.
SCROLL
Program-driven scrolling in lists
Variants
1. SCROLL LIST TO FIRST PAGE.
2. SCROLL LIST TO LAST PAGE.
3. SCROLL LIST TO PAGE pag.
4. SCROLL LIST TO COLUMN col.
5. SCROLL LIST FORWARD.
6. SCROLL LIST BACKWARD.
7. SCROLL LIST LEFT.
8. SCROLL LIST RIGHT.
Note
The return code value is set as follows:
SY-SUBRC = 0 O.K.
SY_SUBRC = 4 List limits have been reached – scrolling not possible
SY-SUBRC = 8 List does not exist – scrolling not possible
Variant 1
SCROLL LIST TO FIRST PAGE.
Additions
1. … INDEX idx
2. … LINE lin
Effect
Scrolls
up to the first page of the report displayed on the screen (corresponds
to a command field entry, P– and PP– ). When a basic list is created,
the current list is itself the basic list; When a details list is
created, it is the list directly below it.
Addition 1
… INDEX idx.
Effect
Scrolls to the list level idx . idx corresponds to the value of system field SY-LSIND when creating the report.
Example
Scroll to the beginning of the report at list level 1.
SCROLL LIST INDEX 1 TO FIRST PAGE.
Note
If
a new list (which is to replace the last list displayed) is created at
an event ( AT USER-COMMAND , AT LINE-SELECTION… ), and if you want to
scroll to a particular place in this new list, note the following: A
change made to the system field SY-LSIND is only ever taken into
account after the event. Therefore, SY-LSIND should be manipulated
using the last command belonging to the event (e.g. SY-LSIND = SY-LSIND
– 1 ). A SCROLL command with the addition …INDEX idx must therefore
be used for scrolling in this new list. In this way, scrolling in the
old list (instead of the new list) is avoided.
Addition 2
… LINE lin
Effect
Displays
the report from the line lin (corresponds to the command field entry
PLnn). The standard page header and TOP-OF-PAGE area are not moved
vertically and are therefore ignored when line lin is determined.
Variant 2
SCROLL LIST TO LAST PAGE.
Additions
1. … INDEX idx (see addition 1 of variant 1)
2. … LINE lin (see addition 2 of variant 1)
Effect
Scrolls to the last page of the report displayed on the screen (corresponds to the command field entries P++ and PP++ ).
Variant 3
SCROLL LIST TO PAGE pag.
Additions
1. … INDEX idx (see addition 1 of variant 1)
2. … LINE lin (see addition 2 of variant 1)
Effect
Scrolls to the specified page of the report displayed on the screen (corresponds to the command field entry PPnn ).
Examples
Scroll report on list level 1 to page 7.
SCROLL LIST INDEX 1 TO PAGE 7.
Scroll report on list level 1 to page 7 and display from line 5.
SCROLL LIST INDEX 1 TO PAGE 7 LINE 5.
Note
Although
the list is now displayed from page 7 and line 5, it is precisely this
line which is overlayed by the page header, if a header exists for page
7 (standard header and/or TOP-OF-PAGE lines).
If you want to display
a particular line immediately after the page header, you can use the
function module ‘LIST_SCROLL_LINE_TOPMOST’ which makes the necessary
calculations (according to DESCRIBE LIST … ).
Variant 4
SCROLL LIST TO COLUMN col.
Additions
1. … INDEX idx (see addition 1 of variant 1)
2. … LINE lin (see addition 2 of variant 1)
Effect
Displays
the current page from column col (corresponds to the command field
entry PSnn ). The current page is the last page to be seen on the
screen or the page that was scrolled with a preceding SCROLL LIST
TO…PAGE… statement.
Example
Scroll to page 5 of current report and display this page from column 20.
SCROLL LIST TO PAGE 5.
SCROLL LIST TO COLUMN 20.
Variant 5
SCROLL LIST FORWARD.
Additions
1. … INDEX idx (see addition 1 of variant 1)
2. … n PAGES
Effect
Scrolls down 1 screen page (but no further than the last page; corresponds to the command field entry P+).
Example
Scroll report last displayed one page down.
SCROLL LIST FORWARD.
Addition 2
… n PAGES
Effect
Scrolls n pages (corresponds to the command field entry PP+ n ).
Note
When you use the addition … n PAGES , scrolling is by page, not by screen section.
Variant 6
SCROLL LIST BACKWARD.
Additions
1. … INDEX idx (see addition 1 of variant 1)
2. … n PAGES (see addition 2 of variant 5)
Effect
Scrolls one screen page back (but no further than the first page; corresponds to the command field entry P-).
Addition 2
… n PAGES
Effect
Scrolls n pages backwards (corresponds to the command field entry PP- n ).
Note
When you use the addition … n PAGES , scrolling is by page, not by screen section.
Variant 7
SCROLL LIST LEFT.
Additions
1. … INDEX idx (see addition 1 of variant 1)
2. … BY n PLACES
Effect
The display begins with column 1 of the report (i.e. left-justified; corresponds to the command field entry PS–).
Addition 2
… BY n PLACES
Effect
Shifts
the report n columns. You determine the direction using the parameters
…LEFT… or …RIGHT… (corresponds to the command field entries PS+
n and PS- n ).
Example
Scroll report at last list level displayed 2 columns to the left.
SCROLL LIST LEFT BY 2 PLACES.
Variant 8
SCROLL LIST RIGHT.
Additions
1. … INDEX idx (see addition 1 of variant 1)
2. … BY n PLACES (see addition 2 of variant 7)
Effect
Shifts
the display to the right until that side of the report so far not
visible on the screen is fully visible (i.e. right- justified). This
only makes sense with reports that are defined wider than the standard
screen size by REPORT … LINE-SIZE corresponds to the command field
entry PS++).
Note
Horizontal scrolling is also affected by
the area boundaries set (SET SCROLL-BOUNDARY ) and by “unmovable” lines
(NEW-LINE NO-SCROLLING ).