11-11-2007 12:32 AM
Hi,
I want to add 5 years for exiting date?
Example - if present date is 2007-11-09 need to add 6 years for this date?
that should be 1013-11-08
can any one tell me how to add No of years for existing date?
Thanks in advance.
Venkat
11-11-2007 12:33 AM
11-11-2007 12:44 AM
See code below:
REPORT ZSCNEWDATE.
data: lv_yr type char4,
lv_new_dt type datum.
lv_yr = sy-datum(4) + 6.
concatenate lv_yr sy-datum+4 into lv_new_dt.
write: / 'Today`s Date =', sy-datum,
/ 'Future Date =', lv_new_dt.
Hope this helps.
Cheers,
Sougata.
Was the problem solved? Please close this thread in that case.
Message was edited by:
Sougata Chatterjee
11-11-2007 12:56 AM
Hi Sougata,
Thanks for the repaly,
but this logic will add 5 years to existing date. but date is not changing..
for example - if I want to add 5 years to 2001-01-10 date
the new expire date should be 2006-01-09.
thanks.
Venkat
11-11-2007 1:21 AM
Hi Venkat,
On the same logic of Sougata add the sane for changing the date
data: lv_yr type char4,
lv_new_dt type datum,
lv_date(2) type N..
lv_yr = sy-datum(4) + 6.
<b>lv_date = sy-datum+6(2) - 1.</b>
<b>concatenate lv_yr sy-datum+4(2) lv_date into lv_new_dt.</b>
write: / 'Today`s Date =', sy-datum,
/ 'Future Date =', lv_new_dt.
Regards,
Atish
11-11-2007 1:31 AM
Use the FM MONTH_PLUS_DETERMINE.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = 60 " Number your months in your year
olddate = gs_date " your date.
IMPORTING
newdate = gs_date.
Regards,
Naimesh Patel