READ LINE

READ - Read a list line

Variants:

1. READ LINE line.
2. READ LINE line OF CURRENT PAGE.
3. READ LINE line OF PAGE pag.
4. READ CURRENT LINE.


1. ... INDEX idx
2. ... FIELD VALUE f1 INTO g1
...
fn INTO gn
3. ... LINE VALUE INTO wa

Effect

Reads line no. line in the list, for instance after 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.
To change the contents or format of a list line, use the MODIFY LINE statement with the appropriate additions.

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
...
fn INTO gn

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.)

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 ...).

Effect

The entire contents of the list line that was read are placed in the field wa.

Note

You can use the LINE VALUE addition to place the whole line into a user-defined work area. This is an alternative to using SY-LISEL and is independent of the attributes of the system field (SY-LISEL is 255 characters long).
If you need a work area that can deal with any list width, you should define it with type SLIST_MAX_LISTLINE from type group SLIST.


Additions:
As with variant READ LINE

Effect

As with variant READ LINE line. The line number line 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.)

With multiple level line selection, the read operation always takes place in the list where line selection was performed.

Additions:
As with variant READ LINE

Effect

As with variant 2, but reads the page pag instead of the current page.

Addition:
... FIELD VALUE f1 INTO g1
...
fn INTO gn

Effect

Reads the last line 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) 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 additions 2 and 3 of the variant READ LINE lin