sapdev logo background
sapdev logo sapdev logo
Comments

ABAP MODIFY ITAB SINGLE Statement syntax, information and example SAP source code



Return to Statement index



MODIFY itab - itab_line

Short Reference

ABAP Syntax ... { table_key
| index } FROM wa
[TRANSPORTING comp1 comp2 ...]
[ result ].


ABAP_ADDITION:
... TRANSPORTING comp1 comp2 ...

What does it do? In this variant, the statement MODIFY assigns the content of work area wa to a row specified by a table key in table_key or by a row number in
index . wa is a general expression position .
Use TRANSPORTING to restrict the components comp to be modified. Use result when changing a single row to set a reference to the changed row in the form of a field symbol or a data reference.
For access using table keys, index access to sorted tables and when the
TRANSPORTING addition is used, the wa work area must be compatible with the line type of the primary internal table. Only in the case of insertion using the table index in standard tables without the TRANSPORTING addition can wa be incompatible with the line type of the internal table, and is converted to the line type according to the conversion rules . If an arithmetic expression is specified for wa , the row type of the internal table is considered when determining the
calculation type ein.

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.
When modifying a row in a table, be mindful of table keys that are read only. While overwriting of protected key fields in the primary table key is not checked until runtime, this always results in a syntax error for the secondary table key . If a row whose secondary table key is read only is changed, FROM wa can therefore only be specified together with TRANSPORTING , and no key fields of the secondary key can be specified after TRANSPORTING .
Specifying a calculation expression for wa is usually only a good idea for elementary row types.

ABAP_ADDITION ... TRANSPORTING comp1 comp2 ...

What does it do? The TRANSPORTING addition has the effect that only the declared comp1 comp2 ... components of the work area are assigned to the corresponding components of the line(s) to be changed. For sorted tables and hashed tables , no primary table key components may be declared after TRANSPORTING .
The comp1 comp2 ... component specifications are made in accordance with the rules specified in
Component declaration , with the constraint that after
TRANSPORTING , no attributes of classes can be addressed using the object component selector.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




MODIFY_ITAB_RESULT
MODIFY_ITAB_TABLE_KEY




comments powered by Disqus