MODIFY itab - itab_lines
Short Reference
ABAP Syntax ABAP_KEY
... itab FROM wa [USING KEY
keyname ]
TRANSPORTING comp1
comp2 ... WHERE log_exp
|(cond_syntax).
ABAP_ADDITIONS:
1 ... USING KEY keyname
2 ... WHERE log_exp
3 ... WHERE (cond_syntax)
What does it do? In this variant, the statement MODIFY assigns the
content of the components comp1 comp2 ... of the work area wa
specified after TRANSPORTING to all rows of the table
itab that meet the condition after WHERE . wa is a
functional operand position . The
work area wa must be compatible
with the row type of the internal table.
The addition TRANSPORTING has the same effect as
changing individual rows . The addition
WHERE can only be specified together with the addition
TRANSPORTING .
Latest notes: Outside of classes, an obsolete
short form is possible where FROM wa can be omitted if the
internal table has a header line itab
with the same name. The statement then uses the header line as the
work area implicitly. Furthermore, USING KEY cannot be specified
without USING KEY .
Example ABAP Coding Takes the content of the component planetype for
all rows in the internal table sflight_tab where this component
contains the value p_plane1 and changes it to the value
p_plane2 .
PARAMETERS: p_carrid TYPE sflight-carrid,
p_connid TYPE sflight-connid,
p_plane1 TYPE sflight-planetype,
p_plane2 TYPE sflight-planetype.
DATA sflight_tab TYPE SORTED TABLE OF sflight
WITH UNIQUE KEY carrid connid fldate.
DATA sflight_wa TYPE sflight.
SELECT *
FROM sflight
INTO TABLE sflight_tab
WHERE carrid = p_carrid AND
connid = p_connid.
sflight_wa-planetype = p_plane2.
MODIFY sflight_tab FROM sflight_wa
TRANSPORTING planetype WHERE planetype = p_plane1.
ABAP_ADDITION_1 ... USING KEY keyname
Latest notes: Unlike the processing of a hash table when a primary key
is used, a preceding sort using the SORT statement has no
influence on the processing sequence when a secondary hash key is
specified.
If a secondary table key is specified, any WHERE condition must
be optimizable . Otherwise a syntax
error occurs or an exception is raised.
ABAP_ADDITION_2 ... WHERE log_exp
ABAP_ADDITION_3 ... WHERE (cond_syntax)
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved