cancel
Showing results for 
Search instead for 
Did you mean: 

DP macros and percentage calculation

Former Member
0 Kudos

Hi Experts,

I need some help to resolve an issue I'm having with macro execution at the aggregated level (product / location) and disaggregated level (product / location / sales group).

We have fixed aggregation for POS at product / location / sales group.

This is a very simple example but should show the problem.

Using 3 KF's

KF1 - SAP Stat FC - Calculation type S

KF2 - percentage change - Calculation type A

KF3 - consensus FC - type S

Macro will add a percentage to KF 1 and produce a total in KF3. macro executes as default. This work fines if used at agg level.

But if we add a percentage to a FC at SG level then when aggregated the total is incorrect and not what we want to transfer to R/3.

Example. Total FC of 30 shown below.

SG 1 forecast = 20

SG 2 FC = 10

Update FC at SG

30% is added to SG 1 FC so this is now = 26

SG 2 FC = 10

New total should be = 36

When viewed at agg level, % is now 15 (understand as this is because of 2 SG's) and the total is 35. This become more complex as the number of SG increases.

I've tried using drill down in BG job to correct the answer but it doesn't update the livecache or transfer the correct result.

Hopefully someone knows of a way to work around this.

Thanks in advance.

Paul

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member187488
Active Contributor
0 Kudos

Hi,

First, please set the macro to be executed at detailed level only, in the macro definition. This is quite important.

Then as the above reply, use DET_LEV() to check the level you're on.

If it is not detailed level yet, you can perform an internal drill down, then perform calculation, and perform an internal drill up.

For background run, just control the aggregate level by checking all 3 characterstics: product/location/salese group.

Best Regards,

Ada

Former Member
0 Kudos

Hi Manimaran & Ada,

Thank you both for your help.

I did have a small issue with the characteristic as I hadn't matched the name in upper case.

So for any other users make sure that you copy the technical name exactly. (ie 0SALES_GRP not 0sales_grp).

thanks

Paul

m_manimaran
Active Contributor
0 Kudos

Hi,

Since the macro is default at both aggregated and disaggregate level, we cant control this. To avoid this, you must make the macro executable at the disaggregate level only. But the constrain is you can not have the calculation done at aggregated level.

In your macro, include a IF function to check the detailed level as the Sales group and allow the system to calculate the % increase.

IF

Condition: Check Aggregate level

DET_LEVEL( 'SALES_GRP' ) = 1

KF3 = KF1 + (KF1*KF2/100)

ENDIF

Another option is to run the macro only at the background but not at the interactive planning book. While running the macro job, set the aggregation level as product / location / sales group.

Hope this will help to solve your issue.

Regards,

Manimaran M.