READ - Read a list line
Variants
1. READ LINE lin.
2. READ LINE lin OF CURRENT PAGE.
3. READ LINE lin OF PAGE pag.
4. READ CURRENT LINE.
Variant 1
READ LINE lin.
Additions
1. ... INDEX idx
2. ... FIELD VALUE f1 INTO g1
...
fm INTO gm
Effect
Reads line no. lin in the list, for instance by
line selection ( AT LINE-SELECTION , AT PFxx, AT
USER-COMMAND ).
Places the read line in the field SY-LISEL and automatically
restores all 'hidden' information (see
HIDE ) to the original fields.
Sets the output format of the read line for all subsequent MODIFY
LINE and WRITE statements.
The return code value is set as follows:
SY-SUBRC = 0
Line exists
SY-SUBRC <> 0
Line does not exist
Addition 1
... INDEX idx
Effect
With multiple line selection, reads the line from the
list generated in level idx (0,1,2,...).
Addition 2
... FIELD VALUE f1 INTO g1
...
fm INTO gm
Effect
Transports the contents of the fields f1 ,
f2 , ... from the read list line to the fields g1 ,
g2 , ... . (The field contents stored in the list line always
have the type C; type conversion is the same as for
MOVE .)
Note
All formatting characters in the list output of f1 ,
f2 , ... count as field contents. If a field is output several
times on the selected line, only the first occurrence is taken into
account. If the field (such as f2 ) is not output on the line at
all, the field g2 remains unchanged. The addition INTO
g2 , for example, can be omitted if the field contents are to be
restored to the original field (e.g. f2 ), i.e.
-
... FIELD VALUE ... f2
has the same effect as
-
... FIELD VALUE ... f2 INTO f2
Since the return code value in SY-SUBRC is not affected by the
addition FIELD VALUE , it depends only on the existence of the
selected list line.
Note
The addition FIELD VALUE is especially suitable for
processing user input in list fields (see
FORMAT ,
WRITE ) in the program. (Field
contents entered by the user cannot be addressed with
HIDE .)
Example
You can make a line "selectable" with
-
DATA MARKFIELD(1) TYPE C.
...
WRITE: / MARKFIELD INPUT, 'Text'.
After line selection, you can use
-
CLEAR MARKFIELD.
READ LINE SY-CUROW FIELD VALUE MARKFIELD.
in the program to check whether the user has selected the line or not
( IF MARKFIELD = SPACE ... ).
Variant 2
READ LINE lin OF CURRENT PAGE.
Additions
As with variant READ LINE
Effect
As with variant READ LINE lin . The line number
lin refers to the current page (as specified in the system field
SY-CPAGE at the beginning of the current event. If the contents
of SY-CPAGE is changed by the application program, this does not
affect the display.)
Notes
With multiple level line selection, the read operation is
always take place in the list where line selection was performed.
When returning from line selection, the system always resets the
positioning to the last page displayed. (For scrolling purposes, you
can use the SCROLL statement.)
Variant 3
READ LINE lin OF PAGE pag.
Additions
As with variant READ LINE
Effect
As with variant 2, but reads the page pag instead
of the current page.
Variant 4
READ CURRENT LINE.
Addition
... FIELD VALUE f1 INTO g1
...
fm INTO gm
Effect
Reads the last line to be read (by line selection or
with READ LINE ) once again. You can use this variant, for
example, in connection with the addition FIELD VALUE (see below)
.u.) if you want to retrieve field contents from the selected line (in
cases where you cannot retrieve from the HIDE area).
Addition
... FIELD VALUE f1 INTO g1
...
fm INTO gm
Effect
See addition 2 of the variant READ LINE lin
Index
© SAP AG 1996