‎2007 Mar 28 3:10 PM
Is there a standard function group that provides date addition/subtraction utilities? (ie, add a month, add a quarter, go back a week, add a day and remember about leap year, etc.)
‎2007 Mar 28 3:13 PM
‎2007 Mar 28 3:14 PM
‎2007 Mar 28 3:15 PM
‎2007 Mar 28 3:17 PM
Hi Kristen,
Try this function module:
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = 1
months = 0
signum = '-'
years = 0
importing
calc_date = l_date.
Give '+' or '-' in signum for add or subtract days
Thanks,
Raj.
‎2007 Mar 28 3:19 PM
Hi,
Please use this FM RP_CALC_DATE_IN_INTERVAL.
It handles leap year date calcalution as well.
Regards,
Ferry Lianto
‎2007 Mar 28 3:26 PM
RP_CALC_DATE_IN_INTERVAL is almost perfect. However, when I enter 3/31/07 as the date and +3 months, it gives 7/1/07. I need it to respond 6/30/07...
‎2007 Mar 28 3:31 PM
Hi,
I think it is the correct calculation for adding 3 months from the given date.
But you can always subtract by 1 day from the FM's result to meet your requirement for end of the month date calculation.
data: wa_idate like sy-datum,
wa_odate like sy-datum.
move '20070331' to wa_idate.
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = wa_idate
days = 0
months = 3
signum = '+'
years = 0
importing
calc_date = wa_odate.
wa_odate = wa_odate -1.
write: / wa_odate.
Regards,
Ferry Lianto