SAP MODIFY ITAB ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for MODIFY_ITAB

MODIFY itab

Short Reference
• MODIFY itab ABAP Statement


ABAP Syntax MODIFY { itab_line
| itab_lines }.

What does it do? This statement changes the content of one or more rows itab_line or itab_lines, specified using a table key or a table index.

The following limitations apply when modifying key fields of the primary and secondary table keys:
ABAP Code Snippet The key fields of the primary table key of sorted tables and hashed tables are read-only and must not be modified. This would invalidate internal table administration. Attempts to do this generally raise an unhandleable exception.
The key fields of a secondary table key, however, are only read-only while the secondary table is being used. This is the case in LOOP loops and during the use of the MODIFY statement, in which the secondary key is specified after USING KEY . Otherwise the key fields are not read-only.
ABAP Code Snippet

The administration of unique secondary keys is updated directly after a modification using MODIFY, and produces an unhandleable exception if duplicate entries were to result. The non-unique secondary keys are updated when the secondary table key is next used explicitly ( lazy update).

System Fields sy-subrcMeaning 0At least one row was changed. 4No rows were changed, since no suitable row was found during the search using a table key or in the logical expression, or the specified index was greater than the current number of rows for the search using a table index.

The system field sy-tabix is not set.

Latest notes:Apart from using the MODIFY statement, the content of an individual table row can be changed using assignments to field symbols and dereferenced data references that point to the table row.
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


Non-catchable Exceptions
Reason for error:
Invalid dynamic specification of a row component
Runtime error:
ITAB_ILLEGAL_COMPONENT
Reason for error:
Unzulässige Schlüsselkomponente in der TRANSPORTING
-Liste.
Runtime error:
ITAB_ILLEGAL_TRANSP_COMP A read-only secondary table key would be overwritten
Runtime error:
ITAB_ACTIVE_KEY_VIOLATION
Reason for error:
Memory area violated when TABLES parameter accessed
Runtime error:
ITAB_STRUC_ACCESS_VIOLATION

...More SAP MODIFY Examples

Return to menu