SAP for Public Sector Discussions
Foster conversations about citizen engagement, resource optimization, and service delivery improvements in the public sector using SAP.
cancel
Showing results for 
Search instead for 
Did you mean: 

Dates within a key period.

Former Member
0 Kudos
315

hi all,

I have a abap program to develop, where in i have a period key which i am getting from a table, for a particular BP, CA, CO.

Now i want the all the dates falling in that period key, or may be even the first date of that period key.

For example the period key is weekly, ie 00AA for first week of year 2000, i want all the dates in this week.

I tried many function modules, but none seems to fit my requirement.

Now i have got the year and week no from the description of the period key, so is there any Fm which could give me the first day of the week based on these two inputs...??

All answers will be appreciated....!!!

1 REPLY 1

SrinivasBandi
Explorer
0 Kudos
142

Hi Rahul,

I really about the existance of a generic module to handle what you are looking for the PERSL, since PERSL is more like a customer implementation. We have two variations of it - like 2000 representing year 2000 and 0100 representing the first month of year 2000.

But, you should be able to implement, what you need with the help of the Function module: GET_WEEK_INFO_BASED_ON_DATE.

You begin like this. Take the first date of that year for the PERSL 4000, in this case 01/01/2000, and then add to get the new date as:

01/01/2000 + ( 40 periods X 7 days for week ) = 10/07/2000.

Then use the above FM which gives the result as:

Import parameters Value

DATE 10/07/2000

Export parameters Value

WEEK 200040

MONDAY 10/02/2000

SUNDAY 10/08/2000

In the above week 200040 matches with the period key 4000(40th week of 2000). If this does not match, move the MONDAY and SINDAY either forward or backward by 7 days to match the period that you are interested in.

I think you can put this in a wrapper FM so that all your programs can use it.

Thanks.

For example the period key is weekly, ie 00AA for first week of year 2000, i want all the dates in this week.