... itab FROM wa TRANSPORTING comp1 comp2 ... WHERE log_exp.
With these additions the MODIFY statement assigns the content of the comp1 comp2 ... components of the wa work area specified after TRANSPORTING to all lines in the itab table that meet the logical condition log_exp. The wa work area must be compatible with the line type of the internal table.
The TRANSPORTING addition has the same effect as changing
individual lines. The WHERE addition can only be specified
together with the TRANSPORTING addition. After WHERE, any
logical expression can be specified in which the first operand of each individual comparison is a
component of the internal table. All logical expressions are therefore
possible, with the exception of IS ASSIGNED,
While for standard tables all lines in the internal table are checked for the logical expression of the WHERE addition, optimized access can be achieved for sorted tables and (as of Release 7.0) hashed tables by checking at least an initial part of the table key, in the case of sorted tables, or the entire table key, in the case of hashed tables, for AND-linked equality queries in the logical expression. The optimization also works if the logical expression contains further AND-linked queries with any operator.
Change the contents of the planetype component for
all lines in the sflight_tab internal table in which this
component contains the value p_plane1 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.