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: 

How to modify previous lines in table maintenance

pradiptakumar_mishra
Participant
0 Kudos
97

Hi ,

How to modify previous lines in table maintenance...

Needed info urgently..

Scenario as follows:

matnr       pltyp               datab              datbi
m1            01            01.01.2001         31.12.9999
m1            02            02.03.2002         31.12.9999
m1            03            06.01.2003         31.12.9999
m2            20            01.01.2001         31.12.9999
m2            21            01.01.2004         31.12.9999
m2            22            01.01.2007         31.12.9999
m3            31            01.01.2002         31.12.9999
m3            32            09.01.2006         31.12.9999
 

in the above scenario.

datbi is only diplay mode , user cannot change the value for datbi.

datbi will be changed acording to the datab values for the corresponding matnr .

my required output is as follows

 matnr           pltyp               datab           datbi
m1                01           01.01.2001      01.03.2002
m1                02           02.03.2002      05.01.2003
m1                03           06.01.2003      31.12.9999
m2                20           01.01.2001      31.12.2003
m2                21           01.01.2004      31.12.2006
m2                22           01.01.2007      31.12.9999
m3                31           01.01.2002      08.01.2006
m3                32           09.01.2006      31.12.9999

regards,

Pradipta

3 REPLIES 3

former_member181962
Active Contributor
0 Kudos
57

Hi If it is a custome table do like this.

selct *

from ztab

into table it_ztab.

loop at it_ztab.

lv_tabix = sy-tabix.

lv_tabix_next = sy-tabix + 1.

read table it_ztab index lv_tabix_next.

if sy-subrc = 0.

it_ztab-datbi = it_ztab-datab - 1.

modify it_ztab index lv_tabix.

endif.

endloop.

modify ztab from table it_ztab.

Regards,

Ravi

0 Kudos
57

Hi Ravi..

you forgot to use COMMIT after loop statement and also use table locks as well.

regards,

ram

Former Member
0 Kudos
57

Hi,

Small correction

<b>it_ztab-datbi = it_ztab-datab.</b>

modify it_ztab index lv_tabix.

endif.

endloop.

modify ztab from table it_ztab.

Regards,

Amole