‎2009 Oct 27 6:06 AM
Hi Experts,
I have this scenario. We have a set of date ranges in the internal table like below here:
Date From Date To
a) 1.11.2002 31.10.2003
b) 1.11.2003 31.10.2004
c) 1.11.2004 31.10.2099
I want to modify record "(c)" by replacing the Date From with 1.11.2005. After doing this, the code should also update the previous record "(b)", Date To: 31.10.2005. How do I code this logic?Please advise
‎2009 Oct 27 6:12 AM
Move the from date to an variable and increase the date and also move the to date to another variable and increase
‎2009 Oct 27 6:33 AM
on change of date from.
w_index = sy-tabix - 1.
read table itab into wa2 index w_index.
wa2-date to = date from - 1.
modify itab from wa2.
endon.
hope this should work
‎2009 Oct 27 6:47 AM
You can try like this:
data: begin of itab occurs 0,
from(8) type c,
to(8) type c,
end of itab.
data: a(4) type c.
data: b(4) type c.
itab-from = '01112002'.
itab-to = '31102003'.
append itab. clear itab.
loop at itab.
a = itab-from+4(4).
a = a + 1.
concatenate itab-from+0(2) itab-from+2(2) a into itab-from.
b = itab-to+4(4).
b = b + 1.
concatenate itab-to+0(2) itab-to+2(2) b into itab-to.
write:/ itab-from, / itab-to.
endloop.