Page 1 of 1

Variable or function to calculate parameter date value

Posted: Wed Sep 21, 2011 11:29 am
by roadwarrior01
My client has a requirement to run a program which has one input parameter of Period (i.e. reporting period). The program extracts posted data within the period and creates a flat file which is output for another system to use. We use a non-calendar period scheme (5-4-4 weeks).

The program is to be run weekly Monday morning for the current period-to-date. The exception is that for the first week of say period 2, the program must select the entire prior period 1 (period-end reporting).

I believe it's possible to create a variable or function to deliver this period, based on the above logic and comparing current system date to the corporate business calendar. Anybody done this? All suggestions appreciated, but trying to avoid ABAP.

Re: Variable or function to calculate parameter date value

Posted: Thu Sep 22, 2011 5:17 am
by charles
There are some function modules to avoid writing ABAP

PERIODENANFANG_ERMITTELN Determining period start according to T009B

So I suppose you could use this with the reporting period selection criteria to get the first day of the period - you could then take the reporting period selection criteria + 1 and use it to get the first day of the next period and subtract one day from this to get the last day of the period selected etc etc

Not sure if this helps you but you can search in SE37 for other useful function modules
eg with PERIOD* or DATE*

DATE_TO_PERIOD_CONVERT turns the date into a period if you need to do that

Charles