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

help with dates!!!!

Former Member
0 Likes
583

Hi all,

I need help in this case. for example i have to ranges of dates the begin and the end date. so for example the begin date is 01.01.2006 and the final date is 31.12.9999 so when i modify the end date to 31.12.2006 so, i want to put other row with the same values but the begin date i wanna put it for the next day in this case 01.01.2007.

How can i do this??? is it possible?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
555

Hi Jose

Hope below code gives you some idea:

select-options: s_datum for sy-datum obligatory.

at selection-screen.
  perform change_date.

*&---------------------------------------------------------------------*
*&      Form  change_date
*&---------------------------------------------------------------------*
FORM change_date .

data: l_datum like sy-datum value '99991231',
      l_line type i.

describe table s_datum lines l_line.
loop at s_datum.
   if s_datum-high is initial.
      s_datum-high = l_datum.
      modify s_datum.
   elseif s_datum-high lt l_datum and sy-tabix eq l_line.
      s_datum-low = s_datum-high + 1.
      s_datum-high = l_datum.
      append s_datum.
   endif.
endloop.

ENDFORM.                    " change_date

Kind Regards

Eswar

3 REPLIES 3
Read only

Former Member
0 Likes
555

now, after first row, when ur inserting second row with changing end date then for begin date do this....take v1, v2, v3 as variable.

v1 = date+6(4).

v2 = date+0(2).

v3 = date+3(2).

v1 = v1 + 1.

concatenate v2 v3 v1 into date separated by '.'.

use this date........

Read only

Former Member
0 Likes
555
LOOP AT R_DATES. 
  TEMP = R_DATES-HIGH.
  R_DATES-HIGH = '12312006 '.
  MODIFY R_DATES.
  R_DATES-LOW = R_DATES-HIGH + 1.
  R_DATES-HIGH = TEMP.
  APPEND R_DATES.
ENDLOOP.

Regards,

Ravi

Note - Please mark all the helpful answers

Read only

Former Member
0 Likes
556

Hi Jose

Hope below code gives you some idea:

select-options: s_datum for sy-datum obligatory.

at selection-screen.
  perform change_date.

*&---------------------------------------------------------------------*
*&      Form  change_date
*&---------------------------------------------------------------------*
FORM change_date .

data: l_datum like sy-datum value '99991231',
      l_line type i.

describe table s_datum lines l_line.
loop at s_datum.
   if s_datum-high is initial.
      s_datum-high = l_datum.
      modify s_datum.
   elseif s_datum-high lt l_datum and sy-tabix eq l_line.
      s_datum-low = s_datum-high + 1.
      s_datum-high = l_datum.
      append s_datum.
   endif.
endloop.

ENDFORM.                    " change_date

Kind Regards

Eswar