cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic date calculations containing posting periods

Former Member
0 Kudos

Hi Gurus,

I have a problem, I hope you will be able to help me.

I need dynamic data calculations for backgrounds jobs to do as follows:

1. "From date" must be the start of the current posting year (fiscal posting period)

"To date" must be the end of the current posting year (fiscal posting period)

2. "From date" must be the start of the next posting year (fiscal posting period)

"To date" must be the end of the next posting year (fiscal posting period)

Looking forward to hearing from you

/Brian

Accepted Solutions (1)

Accepted Solutions (1)

abhay_kapase
Active Participant
0 Kudos

Hi Brian,

This is possible by using Dynamic variable which is standard SAP functionality.

When you are defining a variant for any transaction/program, go to variant attributes and you will find all the field names available.

There is "Selection Variable" attribute available for each of the fields. Here you need to see option "D" which is dynamic date calculation.

Now you need to implement a function module to calculate this date.

BAPI_COMPANYCODE_GET_PERIOD and DETERMINE_PERIOD to retrieve fiscal year and fiscal period for a specific date.

Here is a link which I found which has the code which needs to be implemented.

http://www.sapdev.co.uk/fmodules/fms_fiscalyr.htm

This code in the link is available free on the internet. It is neither developed by me nor I own it.

Hope this gets you going.

Regards,

Abhay Kapase

Former Member
0 Kudos

Hi Abhay,

Thank you very much for you swift reply.

I am aware of the "D" for dynamic selection, but how can I combine this with a abap program. It seems as though I only have "pre-defined" options such as "current date".

Br Brian

abhay_kapase
Active Participant
0 Kudos

Hi Bryan,

You have to use Function module which I have mentioned in the above reply to calculate fiscal start and end date. In that you have to define a variable which can be selected here in D option.

You can refer the code which I pasted in the link. Take a help of ABAPer, who will be aware of these things.

Let me know If this works. This is one standard SAP solution in such cases.

If this does not work then we can use TVARVC table to define a variable of our choice. But I really dont think we have to use TVARVC table for this.

You have to create a z program to update variants in TVARVC table. In this program you have to define a variant of your choice and logic which is needed to update this variant.

This is pretty much standard requirement which can be done as I explained above.

Let me know how it goes. Keep posting updates!!

Regards,

Abhay Kapase

Edited by: AbhayKapase on Aug 10, 2011 5:42 PM

Edited by: AbhayKapase on Aug 10, 2011 5:45 PM

Answers (0)