11-18-2013 9:12 PM
Hello,
I am working on a new function module where on the selection screen i have the period type ( allowed values are 'D','W','M' for day,week and month).
And have one more input for date_period(it will allow integer upto 999).
My requirement is to calculate a date based on the period_type and date_period.
For example, if the period_type is 'M' (monthly) and date_period is 10, then the date should be current date + 10 months.
if the period_type is 'W' (weekly) and date_period is 10, then the date should be current date + 10 weeks.
And the same with 'D'.
Please note that i am working in APO environment. There is a FM module in ECC 'RP_CALC_DATE_IN_INTERVAL' which mostly matches my requirement but its not available in APO.
Any help would be appriciated.
11-19-2013 4:00 PM
Found the FM - SEPA_MANDATE_ADD_MONTH_TO_DATE which works for month.
But still need a solution for weeks.
11-18-2013 10:20 PM
Hi,
If you have Class CL_RECA_DATE available in your APO system, you could work with its static methods especially ADD_TO_DATE looks promising in regards to your requirement.
Cheers,
Sougata.
11-19-2013 2:32 PM
Unfortunatley, i do not see that class available in our APO system.
11-19-2013 2:46 PM
Hi
For adding months, you can try with the FM 'MONTH_PLUS_DETERMINE'.
For weeks I don't know any standard FM. Think that each 7 or 8 years there is a year of 53 weeks. You can create your own FM, if for instance you want to add 10 weeks, obtain days (ie: 10 * 7 = 70 days), add these days to the original date and with the FM 'DATE_GET_WEEK' get the weeks for the first day and the calculated day.
I hope this helps you
Regards
Eduardo
11-19-2013 2:49 PM
'MONTH_PLUS_DETERMINE' looks like an ECC Function module.
My requirment is in APO.
11-19-2013 4:00 PM
Found the FM - SEPA_MANDATE_ADD_MONTH_TO_DATE which works for month.
But still need a solution for weeks.
11-19-2013 4:08 PM
Can you not code your own logic for weeks?
End date = Start date + (7 * number of weeks).
Regards,
Nick