2009 Feb 18 6:17 AM
Hi experts,
I have one internal table with 40000 records.
Now I want to read the particular record with key. So I am using
READ TABLE TABNAME WITH KEY FIELD = 'XYZ'.
But I want the record number (INDEX of int table or SY-TABIX in LOOP....ENDLOOP) of selected record.
I can find it using Loop ...Endloop...
But that int table is huge, So this option is not suitable.............
Could anybody suggest me an alternative.......
Thanks.................
2009 Feb 18 6:20 AM
hi
declare a global variable of type int and after you read teh record with
READ TABLE TABNAME WITH KEY FIELD = 'XYZ'.
if sy-subrc = 0, assign the sy-tabix value to that global variable.
the sy-tabix returns the table index of the record whether u use it in loop-endloop or with read statement.
2009 Feb 18 6:19 AM
you can create one more field in your internal table and use count in that field whenever you fetch the record get the count field value also so that you will get the index
2009 Feb 18 6:20 AM
hi
declare a global variable of type int and after you read teh record with
READ TABLE TABNAME WITH KEY FIELD = 'XYZ'.
if sy-subrc = 0, assign the sy-tabix value to that global variable.
the sy-tabix returns the table index of the record whether u use it in loop-endloop or with read statement.
2009 Feb 18 6:22 AM
Hi,
Try like this...
READ TABLE TABNAME WITH KEY FIELD = 'XYZ'.
lv_index = sy-tabix.
Hope its helps
2009 Feb 18 6:26 AM
Hello
READ TABLE TABNAME WITH KEY FIELD = 'XYZ'.
IF SY-SUBRC = 0.
INDEX = SY-TABIX. " SY-TABIX - record number
ENDIF.
2009 Feb 18 6:36 AM
Hi,
try this .
data w_index type i.
READ TABLE TABNAME WITH KEY FIELD = 'XYZ'.
if sy-subrc eq 0.
w_index = sy-tabix.( This holds the index number of the record )
endif.
2009 Feb 18 6:44 AM
Hi,
Why you want to use another loop-endloop forreading the sy-tabix when after the the same READ statement you can read the sy-tabix that gives the index of the current record.
Is there anything else you wan to do?
Pooja