Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs →  Classic Lists →  Process lists in the list buffer 

READ LINE

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


READ { {LINE line [{OF PAGE page }|{OF CURRENT PAGE}] 
                 [INDEX idx] }
     | {CURRENT LINE} }
     [result].

Extras

1. ... LINE line [{OF PAGE page }|{OF CURRENT PAGE}] [INDEX idx]

2. ... CURRENT LINE

Effect

This statement assigns the content of a row 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 row stored with HIDE are assigned to the respective variables.

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

System Fields

sy-subrc Relevance
0 The specified row is available and was read.
Not equal to 0 The specified row does not exist.

Addition 1

... LINE line [{OF PAGE page }|{OF CURRENT PAGE}] [INDEX idx]

Effect

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 INDEX, 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 INDEX 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 row is selected if no row 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 row 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.

Addition 2

... CURRENT LINE

Effect

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


Example

This example reads all rows of the basic list after selecting a row. The content of the checkbox is assigned to the output data object flag. A target field wa with lenght 10 is used for the date, since this is th length of the output area and contains separators. If you assigned 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. 

Continue

READ LINE - result