LINE_EXISTS ABAP | Check line exists in table ABAP

Сheck internal table ABAP for the presence of a record with LINE_EXISTS ABAP in new ABAP syntax. Checking the existence of a record in an internal table is a common task in ABAP programs. I create simple example how it was in old ABAP syntax and in new syntax ABAP.

When we found or not found rows in internal table ABAP with LINE_EXISTS value variable sy-sybrc and sy-tabix don’t change. Not the same like for READ TABLE!

Examples using LINE_EXISTS ABAP

  • With one field and NOT, for example, we check line not exists in this internal table ABAP
  • With two and more fields and you also can create KEY for lt_sflight if it would be better for performance
  • Using in real work for check errors in internal table log ABAP
  • Check, for example, buttons internal table SAP and etc.

Performance LINE_EXISTS ABAP

You need to use LINE_EXISTS correct and think about performance. If table too big and you need to use LINE_EXISTS a lot of times will think about KEY for this internal table. For example this code ABAP with using HASHED TABLE with KEY.

Usage LINE_EXISTS additions

  • Using LINE_EXISTS with empty table. If internal table ABAP empty we get result ABAP_FALSE and for example in this code BREAK-POINT will not be executed.

and you not need check table before LINE_EXISTS like this:

Leave a Reply