SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Processing Internal Data → Internal Tables → Expressions and Functions for Internal Tables → table_exp - Table Expressions →table_exp - itab_line
Syntax
... { [KEY keyname INDEX] idx }
| { comp1 = operand1 comp2 = operand2 ... }
| { KEY keyname [COMPONENTS] {comp_name1|(name1)} = operand1
{comp_name2|(name2)} = operand2
... } ...
Alternatives:
1. ... [KEY keyname INDEX] idx
2. ... comp1 = operand1 comp2 = operand2 ...
3. ... KEY keyname [COMPONENTS] ...
Effect
Specifies a table row in the square brackets of a table expression. This makes three alternatives possible:
Note
The square brackets shown here indicate the optional additions and are not part of the syntax.
Example
See Table Expressions, Specified Rows.
... [KEY keyname INDEX] idx
Effect
The table expression reads the row with the row number specified in idx with respect to a table index. The row is read in exactly the same way as when specifying an index, INDEX idx [USING KEY keyname], in the statement READ TABLE. Similarly, idx is a numeric expression position and the optional KEY keyname INDEX is equivalent to the USING KEY keyname specified. If the optional addition is not used, itab must be an index table. If the addition is used, the secondary table index of a sorted secondary key can be specified statically or dynamically.
If no row is found for the specified index, the handleable exception CX_SY_ITAB_LINE_NOT_FOUND is usually
raised. Exceptions to this rule are uses in the statement
ASSIGN, in the predicate function
line_exists, and in the table function line_index.
... comp1 = operand1 comp2 = operand2 ...
Effect
The table expression reads the row in accordance with the specified free search key. The search is performed in exactly the same way as when specifying the free search key comp1 = operand1 comp2 = operand2 ... in the statement READ TABLE. Similarly, the components comp1 comp2 ... can be specified in accordance with the rules from the section Specifying Components. Also, compatible or convertible operands operand1 operand2 ... must be specified that are general expression positions.
If no row is found for the specified free key, the handleable exception CX_SY_ITAB_LINE_NOT_FOUND is usually raised. Exceptions to this rule are uses in the statement ASSIGN, in the predicate function line_exists, and in the table function line_index.
Notes
... KEY keyname [COMPONENTS] ...
Effect
The table expression reads the row in accordance with the explicitly specified table key.
Unlike the statement READ TABLE, a table expression must specify the name of the table key and the addition COMPONENTS can be omitted. Like here, the table key keyname and the key components can be specified statically or dynamically. The operands operand1 operand2 ... are general expression positions.
If no row is found for the specified table key, the handleable exception CX_SY_ITAB_LINE_NOT_FOUND is usually raised. Exceptions to this rule are uses in the statement ASSIGN, in the predicate function line_exists, and in the table function line_index.
Notes