‎2007 Sep 18 7:36 PM
Hi All,
Can someone let me know how to add or substract the days for a given date?
My requirement is as follows,
If the given date is 18.09.2007 then i have to substract 30 days from this. the output should be 19.08.2007.
and, for adding 90 days, if the given date is 18.09.2007, the output should be 17.12.2007.
i.e., the application should consider if any month is having 31 days.
regards,
sailesh
‎2007 Sep 18 7:39 PM
This is built into the date data type, so it is all handled by the ABAP envirnoment, simply subtract and add to the date. It works.
data: 30_days_ago type sy-datum.
data: 90_days_ahead type sy-datum.
30_days_ago = sy-datum - 30.
90_days_ahead = sy-datum + 90.Works across months, years, and even handles leap years.
Regards,
Rich Heilman
‎2007 Sep 18 7:39 PM
This is built into the date data type, so it is all handled by the ABAP envirnoment, simply subtract and add to the date. It works.
data: 30_days_ago type sy-datum.
data: 90_days_ahead type sy-datum.
30_days_ago = sy-datum - 30.
90_days_ahead = sy-datum + 90.Works across months, years, and even handles leap years.
Regards,
Rich Heilman
‎2007 Sep 18 7:40 PM
Hi,
You can also use FM RP_CALC_DATE_IN_INTERVAL.
Regards,
Ferry Lianto
‎2007 Sep 18 7:45 PM