10-18-2007 10:18 AM
Hi all,
I have to add 120 days into the system date i.e.sy-datum and then subtract 5 days from the added one
How to do this...
Plz reply soon....
10-18-2007 10:22 AM
hi Rahul,
data : lv_date type sy-datum.
lv_date = sy-datum + 115.
hope this helps
ec
10-18-2007 10:22 AM
hi Rahul,
data : lv_date type sy-datum.
lv_date = sy-datum + 115.
hope this helps
ec
10-18-2007 10:23 AM
hi
u can subtract like normal mathematical operation.just store outpur in the date type variable.
regards
vivek
10-18-2007 10:23 AM
10-18-2007 10:23 AM
data: zday type d.
zday = 'sy-datum'.
zday = zday + 120.
and thrn
zday=zday-5,
10-18-2007 10:23 AM
sy-datum stores the value in this format YYYYMMDD .
use this code and it will work automatically for you, The system handles the no of days in the month.
data: wf_datu like sy-datum.
wf_datu = sy-datum.
wf_datu = wf_datu - 120 + 5.
write: wf_datu.
thanks,
Amit
10-18-2007 10:24 AM
data : v_date1 like sy-datum , v_date2 like sy-datum.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = sy-datum
days = 120
months = 0
SIGNUM = '+'
years = 0
IMPORTING
calc_date = v_date1.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = v_date1
days = 5
months = 0
SIGNUM = '-'
years = 0
IMPORTING
calc_date = v_date2.
10-18-2007 10:25 AM
DATA: d LIKE sy-datum,
dd LIKE sy-datum.
START-OF-SELECTION.
d = sy-datum.
dd = d + 120.
ddd = dd - 5.
WRITE:/ 'd =', d.
WRITE:/ 'dd =', dd.
WRITE:/ 'ddd =', ddd.
10-18-2007 10:26 AM
Hi,
use the FM:
<b>RP_CALC_DATE_IN_INTERNAL</b> add/subtract year/month/days from a date
Hope this helps.
Reward if helpful.
Regards,
Sipra
10-18-2007 10:27 AM
hi! Rahul
get the day, month, year separately and then add 120 to day
date1 = sy-datum
day = date1+6(2).
month = date1+4(2) .
year = date+0(4).
add_date1 = day + 120.
concatenate year month add_date1 to add_date. " as per sap default format
final_date1 = add_date1 - 5.
concatenate year moth final_date1 to final_date.
why you have add and subtract instead you can directly add by 115.
Reward me if its useful
Regards,
Nagulan
10-18-2007 10:30 AM
Hi Rahul,
You can use this function:
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = 25 -
> give the no of days to be added
months = 3 -
> give the no of months to be added
years = 0 -
> give the no of years to be added
signum = '+'
importing
calc_date = wa_date.
Reward useful answers.