Posts

Showing posts from August, 2022

Abap predefined function line_index

As part of the ABAP  predefined functions  series, today I wanted to talk about the predefined function  LINE_INDEX . As the name suggests, the function returns the row index of an internal table found using table expressions. Syntax:   result =  line_index ( table_expression). Features : - If the row in question is not found, no exception is raised. The value 0 is returned instead. - Supports table expression chaining as long as the result of the expression is also table-like in     the case of nested tables. - Effectively, a functional replacement of READ TABLE statement followed by sy-tabix check. Notes :  - If a hashed table is specified then the result would be -1.  - If a hash key is specified then the result would be -1.   Example : you might think that it's not that impressive as it's not that hard or frequent to know an index of the row in internal tables till you have to know the index of a deeply nested table. below is an example illu