DELETE itab - itab_line

Syntax

... {TABLE itab table_key}
  | {itab [INDEX idx]}.

Alternatives:

1. ... TABLE itab table_key

2. ... itab [INDEX idx]

Effect

These alternatives specify which single line of the internal table itab is to be deleted.

Alternative 1

... TABLE itab table_key


Effect

If you use the variant with the TABLE addition , you specify the line by using the table key table_key.

Alternative 2

... itab [INDEX idx]


Effect

This variant can only be used for standard tables and sorted tables. The line to be deleted, is specified by its table index idx. idx expects a data object of the type i. An exception that cannot be handled occurs, if idx contains a value smaller than 0.

Within a LOOP, you can omit the INDEX addition. In this case, the current table line of the LOOP-pass is deleted. If the current line has already been deleted within the same loop pass, the behavior is not defined.

Example

Deletion of the table line that has the same value as carrid in the key field p_carrid by specifying an index.

PARAMETERS p_carrid TYPE scarr-carrid.

DATA scarr_tab TYPE SORTED TABLE OF scarr
               WITH UNIQUE KEY carrid.

SELECT *
       FROM scarr
       INTO TABLE scarr_tab.

READ TABLE scarr_tab WITH TABLE KEY carrid = p_carrid
                     TRANSPORTING NO FIELDS.

IF sy-subrc = 0.
  DELETE scarr_tab INDEX sy-tabix.
ENDIF.