This exception occurs when the specified table row is not found in the internal table.
The Database Table ztt_db_table2 contains the following entries.
Contact_id Contact_name Contact_address
DATA lt_internal_table TYPE STANDARD TABLE OF ztt_db_table2.
DATA ls_structure TYPE ztt_db_table2.
SELECT contact_id contact_name contact_address FROM ztt_db_table2 INTO TABLE lt_internal_table.
TRY.
IF lt_internal_table [ contact_id = 105 ] – contact_address is initial.
WRITE:/ ‘ Contact address is initial ‘ .
ENDIF.
CATCH cx_sy_itab_line_not_found INTO DATA (lx_errpr) .
ENDTRY.
But where as in Read Table command, the following occurs
READ TABLE lt_internal_table TRANSPORTING NO FIELDS WITH KEY contact_id = 105.
IF sy-subrc = 0.
WRITE:/ ‘Data Row exists’.
ELSE.
WRITE:/ ‘Data Row does not exists’.
ENDIF.
One of the difference between READ Table and Table expressions is accessing a Record which does not exist.
Table expressions : It throws a Runtime Exception CX_SY_ITAB_LINE_NOT_FOUND error.
READ TABLE : The READ TABLE query will be unsuccessful. It returns the value 4 for sy-subrc.