SAP READ LINE ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for READ_LIST_LINE

READ LINE

Short Reference
• READ LINE ABAP Statement


ABAP Syntax READ { {LINE line [{OF PAGE page}|{OF CURRENT
PAGE}]
[ • idx]}
| {CURRENT LINE} }
[result].

ABAP Addition
1 ... LINE line [{OF PAGE page }|{OF CURRENT PAGE}] [ • idx]
2 ... CURRENT LINE

What does it do? This statement assigns the content of a line stored in the list buffer to the system field sy-lisel, and allows other target fields to be specified in result . In addition, all values for this line stored with HIDE are assigned to the respective variables.

The line to be read is specified with the addition LINE or with CURRENT LINE.

System Fields sy-subrcMeaning 0The specified line exists and was read. Not 0The specified line does not exist.
• OF PAGE READ LINE
• OF CURRENT PAGE READ LINE
• • READ LINE

ABAP Addition [ • idx]

What does it do? For the addition LINE, a data object of the type i is expected for line, which includes the line number based on the list page of a list level.

The list level can be specified with the addition , where a data object (which contains the list index) of type i is expected for idx. The value of idx must be greater than or equal to 0. If the addition is not specified, then the list level 0 (the basic list itself) is selected during the creation of the basic list, and the list level at which the event was triggered ( sy-listi) is selected during the processing of a list event.

The list page can be specified either with PAGE page or with CURRENT PAGE. For page, a data object of the type i that contains the page number of an existing page of the list level is expected. No line is selected if no line is found for the specified values in line, idx and page. CURRENT PAGE indicates the topmost displayed page of the list, on which the last list event has taken place. No line is selected while creating the basic list. If no addition is specified for the page, then the current page ( sy-pagno) is selected during the creation of the basic list, and the page on which the event was triggered (sy-cpage) is selected during the processing of a list event.
• CURRENT READ LINE

ABAP Addition

What does it do? For the addition CURRENT LINE, the line on which the screen cursor was positioned during a preceding list event ( sy-lilli), or the last line read with a preceding READ LINE statement, is selected. No line is selected while creating the basic list.



Example ABAP Coding
This example reads all lines of the basic list after
selecting a line. The content of the checkbox is assigned to the output data object flag. A target field wa with length 10 is used for the date, since this is the length of the output area and contains separators. If an assignment was made to the output field date, the area length would be reduced. The checked data is displayed in the details list. DATA: date TYPE d,
flag TYPE c LENGTH 1,
wa TYPE c LENGTH 10.

START-OF-SELECTION.
date = sy-datum.
DO 10 TIMES.
date = date + sy-index.
WRITE: / flag AS CHECKBOX, (10) date.
ENDDO.

AT LINE-SELECTION.
DO.
READ LINE sy-index FIELD VALUE flag
date INTO wa.
IF sy-subrc <(><<)>> 0.
EXIT.
ELSEIF flag = 'X'.
WRITE / wa.
ENDIF.
ENDDO.

Return to menu