Alternative to READ TABLE



ABAP HANA 7.51: Alternative to READ TABLE

There is now an alternate for ‘READ TABLE’ statement which is achieved with help of already existing ASSIGN statement. This is a good to have practice in newer ABAP coding convention if it is used wisely. Some important points to be noticed here:

  • An Internal table lookup can be done by using INDEX of the row
    • If an invalid index is used to reference data i.e. a row at referred index doesn’t exist, in that case, runtime exception CX_SY_ITAB_LINE_NOT_FOUND is thrown.
  • An Internal table lookup is possible by searching with a field-value pair.
  • The binary Search option is not available in this variant. All searches are essentially sequential search.
    • If Internal table data is huge and sorted, it is recommended to use READ TABLE… BINARY SEARCH option to achieve better performance.

Sample Source Code: Variant 1 – ASSIGN index


Output: Variant 1 – ASSIGN index


Sample Source Code: Variant 2 – READ with field


The source code is given just for illustration. No output is provided for this example.

Sample Source Code: Variant 3

Runtime error “cx_sy_itab_line_not_found” is thrown if index can’t be read. This should be particularly taken care in advance to minimize chances of runtime errors.


Output: Variant 3


Check the video for Illustration and Example:

Find the code on GitHub:

Go to Code



Leave a Reply