Variable or function to calculate parameter date value

Financials (FI, CO, TR, EC)

Moderators: Snowy, thx4allthefish, Baz, darkduck

Post Reply
roadwarrior01
Posts: 236
Joined: Wed Apr 05, 2006 1:18 pm
Location: Calgary

Variable or function to calculate parameter date value

Post by roadwarrior01 » Wed Sep 21, 2011 11:29 am

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.

charles
Posts: 8
Joined: Tue Sep 21, 2004 7:06 am
Location: UK

Re: Variable or function to calculate parameter date value

Post by charles » Thu Sep 22, 2011 5:17 am

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

Post Reply