Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing Internal Data →  Internal Tables →  Expressions and Functions for Internal Tables →  Table Functions →  line_index - Index Function 

Internal Tables, Index Function

The example demonstrates the table function line_index.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA idx TYPE TABLE OF i.

    idx = VALUE #(
          ( line_index( flight_tab[ carrid = 'UA'
                                   connid = '0941'
                                   ##primkey[id] ] ) )
          ( line_index( flight_tab[ KEY id
                                   carrid = 'UA'
                                   connid = '0941' ] ) )
          ( line_index( flight_tab[ KEY id
                                   carrid = 'xx'
                                   connid = 'yyyy' ] ) )
          ( line_index( flight_tab[ cityfrom = 'FRANKFURT'
                                   cityto   = 'NEW YORK'
                                   ##primkey[cities] ] ) )
          ( line_index( flight_tab[ KEY cities
                                   cityfrom = 'FRANKFURT'
                                   cityto   = 'NEW YORK'  ] ) )
          ( line_index( flight_tab[ KEY cities
                                   cityfrom = 'xxxxxxxx'
                                   cityto   = 'yyyyyyyy'  ] ) ) ).

    cl_demo_output=>display( idx ).

Description

Various row numbers in the same internal table as in used in Example of Specified Rows are read and inserted in an internal table, idx:

  • The row number of a row in the primary table index found using a free search key.
  • The number -1, since the secondary hash key id is used.
  • The number 0, since no row is found (0 overrides -1).
  • The row number of a row in the primary table index found using a different free search key.
  • The row number of a row found in the associated secondary table index using the sorted table key cities.
  • The number 0, since no row is found.