LINE_INDEX

Index

 

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

LINE_INDEX_Var1_source

Output: Variant 1

LINE_INDEX_Var1_output

Sample Source Code: Variant 2

LINE_INDEX_Var2_source

Output: Variant 2

LINE_INDEX_Var2_output

Check the video for Illustration and Example:

Find the code on GitHub:

Go to Code

Index

 

Leave a Reply