ABAP HANA 7.51: LINE_INDEX Function
The Function LINE_INDEX can be used to search an Internal Table. This returns the table index where the 1st search result is found. Argument of this function can be a simple check or an expression. Some important points to be noted here:
- LINE_INDEX works as a READ TABLE with TRANSPORTING NO FIELDS which returns SY-SUBRC
- This returns SY-TABIX or SY-INDEX which can indicate the line of the match during the search. If no line matches then zero is returned.
- Function LINE_EXISTS is used just to check existence and doesn’t return the index of result found. LINE_INDEX does both the works i.e. it does existence check and returns the index of the result.
Sample Source Code: Variant 1
Output: Variant 1
Sample Source Code: Variant 2
Output: Variant 2
Check the video for Illustration and Example:
Find the code on GitHub: