‎2008 Mar 07 8:04 AM
temp_index = 5.
LOOP AT d_tokens_tab TRANSPORTING NO FIELDS WHERE sy-tabix GT temp_index AND
str = wa_result-fld_name_begin.
what i am trying to do in above loop is i want to get the row with column str = wa_result-fld_name_begin and THAT ROW MUST BE AFTER THE 5TH ROW.
for this requirement i ahve written above loop but iam getting an error no field called sy-tabix.
can anyone provide a solution.
Thanks & Regards
Amarender Reddy B
‎2008 Mar 07 8:21 AM
Hi,
Try as follows instead of using sy-tabix.
LOOP AT d_tokens_tab FROM 6
WHERE str = wa_result-fld_name_begin.
FROM 6: this will fetch from 6th record and the where condition will work for the rest of the fetched records.
‎2008 Mar 07 8:07 AM
hi,
do this way to get the desired result..
LOOP AT d_tokens_tab where str = wa_result-fld_name_begin.
lv_tabix = sy-tabix.
write : lv_tabix.
endloop.
‎2008 Mar 07 8:09 AM
sonthosh this way, it loops through first 5 lines also, which is not neccessary, actually i need row after 5th row.
‎2008 Mar 07 8:11 AM
sy-tabix must be field of the Internal table ... d_tokens_tab
U cannot use sy-tabix in where condition of loop ..
Instead write as ...
temp_index = 5.
LOOP AT d_tokens_tab TRANSPORTING NO FIELDS WHERE
str = wa_result-fld_name_begin.
if sy-tabix GT temp_index.
<write your coding>
endif.
endloop.
‎2008 Mar 07 8:14 AM
Hi,
U can do LIKE this.
SORT d_tokens_tab BY str.
READ TABLE d_tokens_tab WITH KEY str = wa_result-fld_name_begin
BINARY SEARCH
TRANSPORTING NO FIELDS .
CHECK sy-tabix GT 5.
Do your processing.
After executing the READ TABLE Statement sy-tabix will be set to the position number of the row found.
If u have multiple records then u can do like this.
LOOP AT d_tokens_tab INTO wa FROM 6 WHERE str = wa_result-fld_name_begin.
Do ur processing.
ENDLOOP.
This will start the looping from the 6th record.
Thanks,
Vinod.
Edited by: Vinod Kumar Vemuru on Mar 7, 2008 1:47 PM
‎2008 Mar 07 8:21 AM
Hi,
Try as follows instead of using sy-tabix.
LOOP AT d_tokens_tab FROM 6
WHERE str = wa_result-fld_name_begin.
FROM 6: this will fetch from 6th record and the where condition will work for the rest of the fetched records.
‎2008 Mar 07 12:37 PM