We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!
... itab FROM wa $[USING KEY keyname$]
TRANSPORTING comp1 comp2 ... WHERE log_exp$|(cond_syntax).
1. ... WHERE log_exp
2. ... USING KEY keyname
3. ... WHERE (cond_syntax)
In this variant, the statement MODIFY assigns the content of the components comp1 comp2 ... of the work area wa specified after TRANSPORTING to all lines 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 line type of the internal table.
The addition TRANSPORTING has the same effect as
changing individual lines. The addition WHERE can only be specified together with the addition TRANSPORTING.
Outside of classes, an obsolete short form is possible where FROM wa can be omitted if the internal table has an identically named
itab. The statement then uses the header line as the work area implicitly. Furthermore, USING KEY cannot be specified without FROM wa.
... WHERE log_exp
Static WHERE condition. All rows are processed for which the condition after WHERE is met. You can declare WHERE for all table categories.
After WHERE, you can declare a logical expression log_exp in which the first operand of each operation is a component of the internal table. You cannot specify a predicate function. The components of the internal table must be declared as individual operands and not as part of an expression. You cannot use parenthesized character-type data objects to declare a component dynamically here. The remaining operands of an operation can be any suitable individual operands or calculation expressions, but not components of the internal table. All logical expressions are possible except for the IS ASSIGNED, IS SUPPLIED, and obsolete IS REQUESTED predicates. The specified components can be of any data type. For evaluations, the relevant comparison rules apply.
When standard tables are accessed without a secondary key being specified, access is not optimized since all rows of the internal table are checked for the logical expression of the WHERE addition.
When a sorted key or a hash key is used, that is, when a sorted table, a hashed table, or a secondary table key is accessed, access is optimized in the following circumstances:
If the prerequisites for accessing a sorted or hashed table by means of the primary key are not met, optimization is not achieved and all rows of an internal table are checked as with standard tables.
,,When a secondary
table key is accessed, that is, if one is specified in keyname after USING KEY, optimized
execution is ensured, provided that the prerequisites above are met. Otherwise, a syntax error or exception occurs.
In the column col2 of the internal table itab, the MODIFY statement replaces every negative value with the number 0.
... USING KEY keyname
Using the USING KEY addition, a table key can be specified in keyname with which processing is carried out. The specified table key influences the sequence in which the table rows are accessed, and the evaluation of the remaining conditions.
If the primary table key is specified, processing behaves in the same way as when no key is explicitly specified. If a secondary table key is specified, the sequence in which the rows are accessed is as follows:
In contrast to processing 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.
In the internal table itab, the MODIFY statement replaces the value in the column col1
with "_" if the column col2 contains the value 0. The WHERE condition is evaluated in an optimized way using the secondary key mkey.
... WHERE (cond_syntax)
Dynamic WHERE Condition cond_syntax can be specified as a character-like data object or standard table with character-like data type that, when the statement is executed, contains the syntax of a logical expression (in accordance with the rules of the static WHERE condition) or is initial.
The syntax in cond_syntax is, as in the ABAP Editor, not case-sensitive. When specifying an internal table, you can distribute the syntax over multiple rows. If cond_syntax is initial when the statement is executed, the logical expression is true. Invalid logical expressions trigger an exception from the class CX_SY_ITAB_DYN_LOOP.
The obsolete relational operators (><, =>, and =<) are not supported in cond_syntax.
Like the example for static WHERE conditions, but with a condition for the column col2 that can be entered dynamically.