Application Development and Automation 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: 
Read only

internal table looping

Former Member
0 Likes
745

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
729

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.

6 REPLIES 6
Read only

Former Member
0 Likes
729

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. 

Read only

0 Likes
729

sonthosh this way, it loops through first 5 lines also, which is not neccessary, actually i need row after 5th row.

Read only

Former Member
0 Likes
729

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.

Read only

vinod_vemuru2
Active Contributor
0 Likes
729

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

Read only

Former Member
0 Likes
730

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.

Read only

0 Likes
729

Thank you Ramesh