Skip to content

Check existence of a table line

Check the existence of a line in an internal table, use the function line_exists( ) within an if-clause.

IF line_exists( accounts[ id = 4711 ] ).
  "line has been found
ENDIF.

Old style:

READ TABLE accounts WITH KEY id = 4711 TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
  "line has been found
ENDIF.
From SAP/styleguides under CC BY 3.0 — more details
Last updated on