09-24-2008 9:37 AM
Hi SAP gurus,
How to calculate months to a date.
I have a scenario to minus 20 months to sy-datum.
for example:
24.09.2008 - 20 (months) = 24.01.2007
i have to get the date 24.01.2007.
I have to count the days back to the system date. Is there any function module for this. please let me know.
<removed_by_moderator>
kishore
Edited by: Julius Bussche on Sep 24, 2008 10:53 AM
09-24-2008 9:39 AM
Hi,
Please chech the FM "MONTH_PLUS_DETERMINE".
Hope this will be useful.
Regards,
P.S.Chitra
09-24-2008 9:39 AM
Hi,
Please chech the FM "MONTH_PLUS_DETERMINE".
Hope this will be useful.
Regards,
P.S.Chitra
09-24-2008 9:40 AM
hi,
you can use FM CALCULATE_DATE, importing parameters MONTHS has to be -20 (minus 20)
hope this helps
ec
09-24-2008 9:41 AM
hi,
use
do n times.
HRAR_SUBTRACT_MONTH_TO_DATE
enddo.
Here n = 20 for your case as the FM reduce 1 month from the given date.
Regards,
Anirban
09-24-2008 9:51 AM
Hi kishore,
Use the Fm 'MONTH_PLUS_DETERMINE'
data: new_date type d.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = -12 " Negative to subtract from old date, positive to add
olddate = sy-datum
IMPORTING
NEWDATE = new_date.
write: / new_date.
Good luck,
Bhumika
09-24-2008 9:52 AM
Hi Kishore,
Try this FM:
RP_CALC_DATE_IN_INTERVAL
Add/subtract years/months/days from a date
Or as others have also said do it with the FM:
MONTH_PLUS_DETERMINE
Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.
data: new_date type d.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = -5 " Negative to subtract from old date, positive to add
olddate = sy-datum
IMPORTING
NEWDATE = new_date.
write: / new_date.
With luck,
Pritam.
09-24-2008 10:05 AM
Hi ,
I find the solution for this.
Function module is CCM_GO_BACK_MONTHS.
Thanks for your co-operation.
i awarded all of you with points.
Kishore