SAP DELETE ITAB ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for DELETE_ITAB

DELETE itab

Short Reference
• DELETE itab ABAP Statement


ABAP Syntax DELETE { itab_line |
itab_lines | duplicates }.

What does it do? This statement either deletes one or more rows itab_line or itab_lines specified with a table key or a table index, or it deletes adjacent duplicate rows duplicates.

System Fields sy-subrcMeaning 0At least one row was deleted. 4No rows were deleted, since no appropriate row was found when deleting using a table key or when specifying a logical expression, the index specified when deleting using a table index was larger than the current number of rows, or no duplicate adjacent rows were found.

The system field sy-tabix is not set.

Latest notes:When deleting rows 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 rows to be deleted are contained within an updated part of a relevant index ( lazy update). When deleting a row from a standard table using a secondary key, the primary table index in particular must be updated, and this requires a linear search.
ABAP Code Snippet There is no implicit selection of a suitable key or index. The used table key or table index is always specified uniquely. The syntax check issues a warning if there is a suitable secondary table key but this table key is not used. This warning should be removed through using the key. However, in exceptional cases, it can be bypassed using a pragma.
ABAP Code Snippet



Runtime Exceptions

Catchable Exceptions
CX_SY_ITAB_DYN_LOOP
Reason for error:
Error in a dynamic WHERE condition
Runtime error:
DYN_WHERE_PARSE_ERROR

Return to menu