cancel
Showing results for 
Search instead for 
Did you mean: 

Macro to Sum up Month's History to 1st Bucket of the Month

jagannadhb
Active Participant
0 Kudos

Dear Experts,

We have a requirement to Copy entire month's history to the 1st weekly bucket of the Month.

Please note that we have a SCM Calendar that defines what week belongs to which month to accommodate split weeks.

DP Macro is preferable.

Thanks in advance

Regards

JB

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi JB,

One of the solution to your problem is mentioned by Subhan. That is pretty easy one to implement assuming that you already have posting period and month as time charactristic in you actual sales/Sales history infocube.

Other solution can be using a macro.

Here is what I could think of assuming that your DP PA is based on fiscal variant to take care of split week issue.

Solution to calculate sales history for current month :

Step 1 : Use Variable1 (Layoutvariable_set function) to find current using function (Month(Today))

Step 2 : Define additonal variable2 to calculate current month's sales history. Use Loop  method to compare month of each period bucket against variable1 of step 1. if month matches add sales history to variable2.

Step 3 : Write variable2 value to first bucket of current month

For above solution you may think of building additional data view with 6 past periods and 6 future periods in batch planning book

Hopefully this helps.

Regards,

Anup

Answers (3)

Answers (3)

former_member721730
Active Participant
0 Kudos

Hi JB,

As per my understanding weekly data is loaded from the cube to planning area and you want to update the monthly data in the first week of every month as per monthly calendar. It looks can't don using normal macro process, might be try to using user exit macro.

Instead of that you can convert the the cube data which is having monthly period data can be converted to first week in routine during the data transfer to another cube. So the monthly data can be moved to first week and easily load to planning area from the new cube. Hope this option would be useful.

Thanks,

Saravanan V

Former Member
0 Kudos

Hi JB,

I do not know what SCM calendar is and how and where does it say week belongs to month m1 or m2

If you have multiple periodicity used for storage buckets, then the 1st week BUCKET OF the month can have variable number of days from 1 to 7 days and the month itself can have variable number of week buckets from 4 to 6. In such a situation iterations may not work correctly all the time, if you are copying the entire month's value to the 1st week bucket, the only way to do it is in a storage bucket view wherein you can put the sum total of all the buckets in the calendar month to the first bucket of the calendar month. 

If this is the case then, you need to define layout variables for what month and what # week, and then in next step so the arithmetic based on the value of the variables. I think this will be a macro of moderate complexity.


I am no expert on macros or SAP in general but hope this gives some clues

Thanks

BS


 

jagannadhb
Active Participant
0 Kudos

Hello Experts,

Any suggestions....

Thanks

JB

Former Member
0 Kudos

Hello JB,

In order to achieve your requirement, pls check your Time Based Proportional Factors setting in the Planning Area Settings.

If suppose the Time Based Proportions settings done month to weeks.

Try to maintain the Proportional Factors manually in /n/sapapo/sdp94  for the first week only 100 and the remaining weeks as 0 and then save the proportional factors in the Planning Book.

So when you load the data from Infocube to Planning by using /n/sapapo/tscube  into planning book the entire month data will copy only for First week only and its not split into remaining 3 weeks.

Hope your concern has cleared now. Pls check in the above mentioned manner.

Still if you find any difficulties, reply by your findings.

Regards,

Subhan


jagannadhb
Active Participant
0 Kudos

Hi Subhan,

Thank you for your reply. But this does not meet my requirement.

For example if there are 4 weeks in the month as per factory calendar, the data might come for W1 and W3. Our requirement is sum all the data in all 4 or 5 weeks accordingly and put in 1st bucket of the month in a different key figure.

Our SCM Calendar looks like this, example: Feb 2 falls in 2013 fiscal year and the posting period is 10 (P.10.2013). Similarly May 4 falls in P01.2014

MonthDayPeriodYear Shift
2210-1
3211-1
33012-1
5410
6120
62930
8340
83150
92860
11270
113080
12319

0