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: 

previous record in internal table

Former Member
0 Kudos

HI,

suppose i have two records in my internal table

Prince 3 12/12/1999

menon 4 12/12/2000

When i loop at this and when my record comes to menon i need the date of prince to be stored... how do i proceed.

i.e going on record back.

Any help will be appreciated.

Prince

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Try something like this.

data: index type i.
data: wa like line of itab.

Loop at itab.

  index = sy-tabix - 1.
  read table itab into wa index index.
   if sy-subrc  = 0.
* Now WA contains the previous row of ITAB
   endif.


endloop.

Regards,

Rich Heilman

2 REPLIES 2

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Try something like this.

data: index type i.
data: wa like line of itab.

Loop at itab.

  index = sy-tabix - 1.
  read table itab into wa index index.
   if sy-subrc  = 0.
* Now WA contains the previous row of ITAB
   endif.


endloop.

Regards,

Rich Heilman

0 Kudos

thanks rich,

i think it might have solved my issue

prince