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

how do I modify date ranges

jjay
Participant
0 Likes
925

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

3 REPLIES 3
Read only

Former Member
0 Likes
749

Move the from date to an variable and increase the date and also move the to date to another variable and increase

Read only

ravi_teja10
Explorer
0 Likes
749

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

Read only

former_member222860
Active Contributor
0 Likes
749

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.