1. READ LINE
line.
2. READ
LINE line OF CURRENT PAGE.
3.
READ LINE line OF PAGE pag.
4. READ CURRENT LINE.
READ LINE line.
1. ... INDEX
idx
2. ...
FIELD VALUE f1 INTO g1
...
fn INTO gn
3. ... LINE VALUE INTO wa
Reads line number line of the list, usually after a line
selection (
AT LINE-SELECTION, AT
PFxx, AT USER-COMMAND).
The line is placed in the field SY-LISEL,
and all 'hidden' information (HIDE)
is automatically placed into its original fields.
The output format of the line read is set for
all subsequent
MODIFY LINE and WRITE
statements.
You can change the contents of format of the list line using
MODIFY LINE with the appropriate additinos.
The Return Code is set as follows:
... INDEX idx
Reads the line from the list with level idx (0, 1, 2...) where more than one list level exists.
... FIELD VALUE f1 INTO g1
...
fn INTO gn
The contents of the fields
f1, f2, ...
are transported from the list line to the fields
g1, g2, ...
. (The field contents in the list line always have type C. The system converts types as in the MOVE statement).
All formatting characters in the list output of
f1, f2, ...
count as field contents. If a field is displayed more than once in a list line, only its first occurrence
is copied. If the field, say f2, is not displayed at all
in the line, field g2 remains unchanged. You can omit
the addition INTO g2 if, for example, the field contents
in the original field (f2, for example), are also to be transported back. In other words,
... FIELD VALUE ... f2
has the same meaning as
... FIELD VALUE ... f2 INTO f2
The return value
SY-SUBRC is not affected by the FIELD VALUE addition. In other words, it does not depend on whether the chosen list line exists.
The FIELD VALUE addition is specially intended to process
the user's input in an input field in a list (see
FORMAT, WRITE),
since you cannot address input field using HIDE.
Suppose you make a line "selectable" as follows:
DATA MARKFIELD(1) TYPE C.
...
WRITE: / MARKFIELD INPUT, 'Text'.
After the line selection, you can use
CLEAR MARKFIELD.
READ LINE SY-CUROW FIELD VALUE MARKFIELD.
to find out in the program whether the user selected the line or not (IF MARKFIELD = SPACE ...).
... LINE VALUE INTO wa
The entire contents of the selected list line are transported to field wa.
The LINE VALUE addition allows you to place the entire line contents in a user-defined work area, providing an alternative method of accessing the line that is independent of the attributes of the system field SY-LISEL (length of SY-LISEL is 255 characters).
If you need a work area wa that can accommodate lists
of any width, use the type SLIST_MAX_LISTLINE from type group SLIST.
READ LINE line OF CURRENT PAGE.
As described in READ LINE.
Similar to the READ LINE line variant. The line number
line refers to the current page (system field SY-CPAGE)
at the beginning of the current event. Changing the value of SY-CPAGE in the application program has no influence on the display.
READ LINE line OF PAGE pag.
As described in READ LINE.
As in variant 2, except that the system reads from page pag instead of the current page.
READ CURRENT LINE.
See additions 2 and 3 of the variant READ LINE line.
Rereads the last line to be read (by line selection or READ LINE).
This is useful in conjunction with the FIELD VALUE addition
for retrieving field contents from the selected line in cases where it impossible to use the HIDE area.
Reading Lines from Lists