What does it do? This statement either deletes a line itab_line>> or multiple lines itab_lines>>, which can be specified using a table key or a table index, or it deletes adjacent duplicate lines duplicates>>. System Fields> sy-subrc>>Meaning> 0At least one line was deleted. 4No lines were deleted, since no appropriate line was found when deleting using a table key or when specifying a logical expression, the index specified when deleting using a table index was greater than the current number of lines, or no duplicate adjacent lines were found. The system field sy-tabix> is not set.
Latest notes:
Deleting lines of internal tables using DELETE> does not usually release any memory in the internal table. Statements such as CLEAR>> or FREE>> must be used to release this memory.
An internal table in which all lines have been deleted with DELETE > is empty and the relational expression IS INITIAL>> is true. Nevertheless, the internal table usually still occupies memory and therefore is not in the same state as an initial table after its declaration. BEGIN_SECTION SAP_INTERNAL_HINT Only if all lines of an internal table are deleted using a WHERE> condition, internally a CLEAR> is executed after collecting the lines for deletion and the respective memory is released. But this should not be used as a feature to clear internal tables. END_SECTION SAP_INTERNAL_HINT
When deleting lines in an internal table, costs are incurred for updating all existing table keys> and table indexes>. The primary key> and all unique secondary keys> are updated directly, whereas non-unique secondary keys are only updated if the lines to be deleted are contained within an updated part of a relevant index (lazy update>). When deleting a line from a standard table and the line is found using a secondary key, the primary table index> in particular must be updated, which usually requires a linear search.