Ansicht
Dokumentation

ABAPREAD_TABLE_INDEX - READ TABLE INDEX

ABAPREAD_TABLE_INDEX - READ TABLE INDEX

BAL_S_LOG - Application Log: Log header data   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.
SAP E-Book

READ TABLE, index

Short Reference



... INDEX idx $[USING KEY keyname$] ...

Addition:

... USING KEY keyname

Effect

Using the INDEX 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 INDEX can only be specified for index tables and determines the line to be read from the primary table index.

Note

Table expressions allow corresponding reads to also be performed in operand positions. Here, an index is specified as a numeric argument idx.

Example

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.

Addition

... USING KEY keyname

Effect

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.

Notes

  • If a sorted secondary key exists, the addition INDEX can be used for all table categories, if USING KEY is used.

Example

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.






TXBHW - Original Tax Base Amount in Local Currency   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.

Length: 4462 Date: 20240329 Time: 071312     sap01-206 ( 81 ms )