Get Example source ABAP code based on a different SAP table
• • READ TABLE itab
READ TABLE>, index> Short Reference >
ABAP_SYNTAX ... • idx $[USING KEY keyname>$] ...>
ABAP Addition ... USING KEY keyname>
What does it do? Using the •> addition, the READ> statement reads the line in the line number specified in idx> in a table index. idx> is a numeric expression position> with the operand type i>. If the value of idx> is less than or equal to 0 or greater than the number of table lines, no line is read and sy-subrc> is set to 4. After a successful read, the system field sy-tabix> contains the line number specified in idx> in the primary or secondary table index used. If the addition USING KEY> is not used, the addition •> can only be specified for index tables> and determines the line to be read from the primary table index>.
Latest notes: Table expressions> allow corresponding reads to also be performed in operand positions. Here, an index is specified as a numeric argument idx>>. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 Reading of the first ten lines of the internal table sflight_tab> using the primary table index. Instead of the DO> loop, a LOOP>> or a corresponding iteration expression with FOR>> is used for this purpose. ABEXA 00530 ABAP_EXAMPLE_END • USING KEY READ TABLE itab •
ABAP Addition
What does it do? The addition USING KEY> can be used to specify a table key in keyname>> to specify the table index to be used explicitly. If the table has a sorted> secondary key>, this can be specified in keyname> and the line to be read is then determined from its secondary table index>. A secondary hash key> cannot be specified. If the primary table key> is specified using its name primary_key>, the table must be an index table, and the behavior is the same as if USING KEY> was not specified.
Latest notes:
If a sorted secondary key exists, the addition •> can be used for all table categories, if USING KEY> is used.
Table expressions> allow corresponding reads to also be performed in operand positions. The table key for an index is specified using KEY keyname •>>. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 Reading of the first ten lines of the internal table sflight_tab> using a secondary table index. Instead of the DO> loop, a LOOP>> or a corresponding iteration expression with FOR>> is used for this purpose. ABEXA 00531 ABAP_EXAMPLE_END