ABAP Keyword Documentation → ABAP - Reference → Processing Internal Data → Internal Tables → Processing Statements for Internal Tables
MODIFY itab
Other versions: 7.31 | 7.40 | 7.54
Syntax
MODIFY { itab_line | itab_lines }.
Effect
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:
- 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 theMODIFY
statement, in which the secondary key is specified afterUSING KEY
. Otherwise the key fields are not read-only.
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-subrc | Meaning |
---|---|
0 | At least one row was changed. |
4 | No rows were changed, since no suitable row was found during the search using a table key or inthe 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.
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. - 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.
-
Using a special variant
MODIFY mesh_path
, rows from the last path node of a mesh path can be changed.
Exceptions
Catchable Exceptions
CX_SY_ITAB_DYN_LOOP
-
Cause: Error in a dynamic
WHERE
condition
Runtime Error:DYN_WHERE_PARSE_ERROR
Non-Catchable Exceptions
-
Cause: Invalid dynamic specification of a row component
Runtime Error:ITAB_ILLEGAL_COMPONENT
-
A read-only secondary table key would be overwritten
Runtime Error:ITAB_ACTIVE_KEY_VIOLATION
-
Cause: Memory area violated when
TABLES
parameter accessed
Runtime Error:ITAB_STRUC_ACCESS_VIOLATION