cancel
Showing results for 
Search instead for 
Did you mean: 

How to desagregate data based on dimension property - SAP BPC - Script logic

camille_chenon
Explorer
0 Kudos
587

Hello BPC Expert,

I need some help for a script logic !!

I have a model with dimensions PRESTATION and ITEM.

I need to aggregate my data based on a property (MAPPING). Here is my dimension PRESTATION with the corresponding property MAPPING.

STEP1. First I need to aggregate my data as follow (I do the sum by property):

STEP2. Than I need to populate my initial value with the sum as follow :

I'm able to do STEP 1 but impossible to do STEP2

STEP1 Works well :

//*XDIM_MEMBERSET PRESTATION=<ALL>

*XDIM_MEMBERSET ITEM=ITEM1

*WHEN ITEM

*IS ITEM1

*REC(FACTOR=1,PRESTATION=PRESTATION.MAPPING,ITEM=ITEM2)

*ENDWHEN

*COMMIT

How can I do step 2 please ?
Thank you so much !Camille

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member186338
Active Contributor
0 Kudos

Sorry, but you need to use correct syntax:

*SELECT(%TARGETSALL%,MAPPING,PRESTATION,MAPPING<>'') //not empty targets, non unique
*SELECT(%TARGETS%,ID,PRESTATION,ID=%TARGETSALL%) //only unique targets

*FOR %T%=%TARGETS% //For each target
*RUNALLOCATION
*FACTOR=1
*DIM PRESTATION WHAT=%T%; WHERE=[MAPPING]="%T%"
*DIM ITEM WHAT=ITEM1; WHERE=ITEM2
*ENDALLOCATION
*NEXT
camille_chenon
Explorer
0 Kudos

Thank you so much for this exemple - It helps a lot. I tried hard to make it works but I still have one problem left, my loop FOR %TARGETS% will only run on PRESTA0 and PRESTA4 (Since the SELECT won't include PRESTA2 and PRESTA3) and at the end nothing is post on PRESTA2 or PRESTA3.

I tried several codes

Ex 1.

*SELECT(%ALLPRESTA%,"[ID]",PRESTATION,"[CALC]='N' AND [MAPPING_LOC]<>''")

*SELECT(%PRESTA_MAP%,"[MAPPING]",PRESTATION,"[CALC]='N' AND [MAPPING]<>''")

*SELECT(%PRESTA%,"[ID]",PRESTATION,"[ID]=%PRESTA_MAP%")

**********************

//*XDIM_MEMBERSET PRESTATION=<ALL>

*XDIM_MEMBERSET ITEM=ITEM1

*FOR %EACH_PRESTA%=%PRESTA%

*RUNALLOCATION

*FACTOR=1

*DIM PRESTATION WHAT=%EACH_PRESTA%; WHERE=[MAPPING_LOC]="%EACH_PRESTA%" *ENDALLOCATION

*NEXT

*COMMIT

Ex 2 and 3 : I replace with :

*DIM PRESTATION WHAT=%EACH_ALLPRESTA%; WHERE=[MAPPING_LOC]="%EACH_PRESTA%"

Or

*DIM PRESTATION WHAT=%EACH_PRESTA%; WHERE=<<<; USING=[MAPPING_LOC]="%EACH_PRESTA%"

Or

*DIM PRESTATION WHAT=%ALLPRESTA%; WHERE=[MAPPING_LOC]="%EACH_PRESTA%"

****

Nothing works : it either will fail or post the wrong value at the wrong target.

Thanks a lot and happy Christmas !
Camille

former_member186338
Active Contributor
0 Kudos

Sorry, but "wrong value at the wrong target" is not a professional explanation!

And the code you provided is incorrect in many cases.

Let's check one case:

PRESTA0, ITEM2 has value 200

And this value have to be copied to members with property PRESTATION.MAPPING=PRESTA0:

PRESTA1, ITEM2

PRESTA2, ITEM2

Check the following code:

*RUNALLOCATION
*FACTOR=1
*DIM PRESTATION WHAT=PRESTA0; WHERE=[MAPPING]="PRESTA0"
*ENDALLOCATION

After RUNALLOCATION you can clear value in PRESTA0, ITEM2

P.S. I have no idea what do you mean by MAPPING_LOC

camille_chenon
Explorer
0 Kudos

Hello Vadim,

(Happy New Year !!)

Thank you for taking the time to answer and provide clear examples.

MAPPING_LOC = MAPPING (I simplify my exemple, sorry for the confusion)

In your exemple, the property value (PRESTA0) isn't dynamic, it's hard coded and it's not what I'm trying to do.

This is why I tried with selected member %ALLPRESTA%, %PRESTA_MAP% and %PRESTA%.

Does it make sense ? Thank you !

Camille

former_member186338
Active Contributor
0 Kudos

For step2 you need to perform RUNALLOCATION for each target account of the first step (FOR/NEXT loop). In WHERE use property selection.

camille_chenon
Explorer
0 Kudos

Thank you for this very quick answer Vadim, I'll try your suggestion (I wonder how can I have dynamic value for the property using RUNALLOCATION, But I'll try first and let you know) Camille !

camille_chenon
Explorer
0 Kudos

Good Morning Vadim,

I did couple of tests, but I can't find a way. I tried

*RUNALLOCATION

*FACTOR=1

*DIM PRESTATION WHAT=BAS(TOTAL_PRES); WHERE=BAS(TOTAL_PRES); USING=PRESTATION=[MAPPING]="001GLOB_NA"

*DIM ITEM WHAT=ITEM1; WHERE=ITEM2

*ENDALLOCATION

But first it's not dynamic (I specify a member for the property MAPPING which I don't want to), second it doesn't generate any data and finally, I don't know how to include a LOOP as you suggested. Any suggestion please ?
Thanks a lot for your support
Camille Chenon