Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Index when reading a table with a single key.

Former Member
0 Kudos

When i perform a READ TABLE SENTENCE, is it possible to know in wich INDEX is the result when sy-subrc is 0?

I want to avoid looping the table to know that and sy is not giving me any clue.

Thanks!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

HI,

Just simply you can check like this for understanding.


data:
  t_tab type TABLE OF spfli.

SELECT * from
  spfli
 into table t_tab UP TO 20 rows.

  read table t_tab  transporting no fields with key carrid = 'AZ'.
if sy-subrc eq 0.
  write:/ sy-tabix. " Here it prints as 3 as AZ present at index 3
endif.

Regards and Best wishes.

3 REPLIES 3

SimoneMilesi
Active Contributor
0 Kudos

SY-TABIX

Former Member
0 Kudos

Go with using SY-TABIX - Checks Current line of an internal table

READ TABLE ITAB ASSIGNING <FS> INDEX 3

Former Member
0 Kudos

HI,

Just simply you can check like this for understanding.


data:
  t_tab type TABLE OF spfli.

SELECT * from
  spfli
 into table t_tab UP TO 20 rows.

  read table t_tab  transporting no fields with key carrid = 'AZ'.
if sy-subrc eq 0.
  write:/ sy-tabix. " Here it prints as 3 as AZ present at index 3
endif.

Regards and Best wishes.