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

locate next record

Former Member
0 Likes
958

hi everyone

i have an internal table of string.

Im looping thrugh it based on some conditions. if for example, im on record number 2, how do i access record number 3?

Im doing a comparison between record number X and record number X+1.

1 ACCEPTED SOLUTION
Read only

former_member212005
Active Contributor
0 Likes
923

Hi....what you can do is while looping store initially the record into one temporary string and then compare...

e.g.

LOOP gt_itab INTO gs_itab.

gs_itab_temp = gs_itab.

IF gs_itab-field1 GT gs_itab_temp-field1...."any comparison you want..

ENDLOOP.

For the first iteration you do not have anything to compare with..it will start with second iteration..

So you will be comparing X+1 and X....

6 REPLIES 6
Read only

Former Member
0 Likes
923

Hi,

Either you can use READ statement with the INDEX additon or again you can use LOOP with FROM addtion.

I suggest you use READ statement if you know the row number.

Regards,

Ankur Parab

Read only

Former Member
0 Likes
923

Hi,

What you can do is when you are looping through the iteration you can keep the loops field value in a variable and then in the next loop iteration you can use the stored value...

Read only

former_member212005
Active Contributor
0 Likes
924

Hi....what you can do is while looping store initially the record into one temporary string and then compare...

e.g.

LOOP gt_itab INTO gs_itab.

gs_itab_temp = gs_itab.

IF gs_itab-field1 GT gs_itab_temp-field1...."any comparison you want..

ENDLOOP.

For the first iteration you do not have anything to compare with..it will start with second iteration..

So you will be comparing X+1 and X....

Read only

0 Likes
923

Thanks Vin

It was a realy useful answer

Read only

0 Likes
923

Hi,

That was exactly what i had also suggested ..

Read only

0 Likes
923

may be i didnt understand u well, sorry

thanks sneha