READ TABLE itab { table_key
| free_key
| index } result.
This statement reads a row from internal table itab. You have to specify the row by either naming values table_key for the table key, a free condition free_key or an index index. The latter choice is possible only for index tables. The output result result determines when and where the row contents are read.
If the row to be read is not uniquely specified, the first suitable row is read. In the case of index tables, this row has the lowest table index of all matching rows.
System Fields
The statement READ TABLE sets system fields sy-subrc and sy-tabix.
sy-subrc | Relevance |
0 | Row found. sy-tabix is set to the table index of the entry for index tables, and to the value 0 for hashed-tables. |
2 | Like sy-subrc equals 0. Differentiates cases that use the addition COMPARING in result. |
4 | Row not found. If the entry was determined with a binary search, then sy-tabix is set to the table index of the entry before which it would have to be inserted with INSERT ... INDEX ..., if you want to keep the sorting order. This is the case if the addition table_key or free_key was specified for a beginning part of the table key of sorted tables, or if the addition BINARY SEARCH was specified explicitly. Otherwise, sy-tabix is undefined. |
8 | Like sy-subrc equals 4. If the entry was determined with a binary search, and the end of the table was reached, then sy-tabix is set to the number of rows + 1. |
The system fields sy-tfill and sy-tleng are also supplied with data.
Besides the alternatives shown above for specifying the row to be read, there is another obsolete key
specification obsolete_key possible.
Non-Catchable Exceptions