ABAP Keyword Documentation → ABAP - Reference → Processing Internal Data → Internal Tables → Processing Statements for Internal Tables → MODIFY itab → MODIFY itab - itab_line
MODIFY itab - table_key
Other versions: 7.31 | 7.40 | 7.54
Syntax
... TABLE itab [USING KEY keyname] ... .
Effect
For wa
, a work area compatible to the row type of the internal table must be specified. This concerns
functional operand
positions. The first row of the internal table found, whose values in the columns of the table key
used match those of the corresponding components of wa
, is processed. If the key fields in wa
are empty, no entries are processed.
If the USING KEY
addition is not specified, the
primary table key
is used. If the USING KEY
addition is specified, the table key specified in keyname
is used.
When searching for the row to be modified, the same rules apply as for key access using statement READ
.
If a standard table is accessed using the primary table key and this is empty, the first row of the internal table is modified.
Note
If the primary table key is used, note that this can also be the standard key, whereby unexpected effects may occur:
- For structured row types, the standard key encompasses all character and byte-like components.
-
The standard key of a standard table can be empty.
Example
Conversion of the local currency of an airline by means of primary key access to internal table scarr_tab
.
PARAMETERS p_carrid TYPE scarr-carrid.
DATA scarr_tab TYPE SORTED TABLE OF scarr
WITH UNIQUE KEY carrid.
DATA scarr_wa TYPE scarr.
SELECT *
FROM scarr
INTO TABLE scarr_tab.
READ TABLE scarr_tab INTO scarr_wa
WITH TABLE KEY carrid = p_carrid.
scarr_wa-currcode = 'EUR'.
MODIFY TABLE scarr_tab FROM scarr_wa
TRANSPORTING currcode.