Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Date Calculations

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Found the FM - SEPA_MANDATE_ADD_MONTH_TO_DATE which works for month.

But still need a solution for weeks.

6 REPLIES 6

Sougata
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Unfortunatley, i do not see that class available in our APO system.

eduardo_hinojosa
Active Contributor
0 Kudos

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

0 Kudos

'MONTH_PLUS_DETERMINE' looks like an ECC Function module.

My requirment is in APO.

Former Member
0 Kudos

Found the FM - SEPA_MANDATE_ADD_MONTH_TO_DATE which works for month.

But still need a solution for weeks.

0 Kudos

Can you not code your own logic for weeks? 

End date = Start date + (7 * number of weeks).

Regards,

Nick