Hi Experts,
I have to create data model showing shifts of Positions from one cost center to another comparing two different plan cycles. I have in my primary model for each plan cycle the position id a unique record.
I created a new model having current & prior cost center information as separate dimension in the model.
With a Data Action i am able to create a combined records. Unfortunately i was only able doing this with a foreach statement. For my test it worked perfectly, but in the reality its not coming to an end because of high amount of positions and cost centers. Therefore i need some help how to replace the for each with a result lookup.
primary model

target "shift" model
after having run Cross model copy function the content looks like following.

after executing data action with forereach …. the result is like below....

Below data action
MEMBERSET [d/prior_cycle] = %PriorCycle%
MEMBERSET [d/current_cycle] = %CurrentCycle%
MEMBERSET [d/type] = "02"
INTEGER @lv_combi
// //-----------------------------------------------------------------------------------
// //Calculation and Data Writing
// //-----------------------------------------------------------------------------------
//=================================================================================================//
// Step 1
//=================================================================================================//
FOREACH.BOOKED [d/Position_], [d/current_costcenter]
@lv_combi = 0
IF RESULTLOOKUP([d/current_costcenter] = "#") != 0 THEN
@lv_combi = 1
ENDIF
IF @lv_combi = 1 THEN
@lv_combi = 0
FOREACH [d/prior_costcenter]
IF RESULTLOOKUP([d/prior_costcenter] = "#") != 0 THEN
@lv_combi = 1
ENDIF
IF @lv_combi = 1 THEN
DATA([d/type] = "14", [d/Account] = "FTE_prior") = RESULTLOOKUP([d/current_costcenter] = "#", [d/Account] = "FTE_prior")
ENDIF
ENDFOR
ENDIF
ENDFOR
//=================================================================================================//
// Step 2
//=================================================================================================//
FOREACH.BOOKED [d/Position_], [d/prior_costcenter]
@lv_combi = 0
IF RESULTLOOKUP([d/prior_costcenter] = "#") != 0 THEN
@lv_combi = 1
ENDIF
IF @lv_combi = 1 THEN
@lv_combi = 0
FOREACH [d/current_costcenter]
IF RESULTLOOKUP([d/current_costcenter] = "#") != 0 THEN
@lv_combi = 1
ENDIF
IF @lv_combi = 1 THEN
DATA([d/type] = "13", [d/Account] = "FTE_current") = RESULTLOOKUP([d/prior_costcenter] = "#", [d/Account] = "FTE_current")
ENDIF
ENDFOR
ENDIF
ENDFOR
Thank you
Dieter
Request clarification before answering.
Hi,
You can use an allocation method to assign the value to the cost center after copying the data.
step to be followed
1. use a source dimension as cost-center and target as cost-center
filter account dimension with FTE_prior
step
driver account should be FTE_Current.
Please let me know if you need more information.
Thanks,
Saurabh S.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dieter,
In my experience, when you bring in multiple dims to the FOREACH you are going to have a long run time on the DA. When combining the dims in the FOREACH statement, you are cycling through every combination of the dims in the FOREACH. Try removing the cost centers and leave the Position. I think your IF statements will handle what you are trying to do in the FOREACH with the Cost Center.
Dan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dan,
i tried your proposal. Not sure if I understood correct, but its now creating a record for each available cost center from master data dimension.
the code is like :
MEMBERSET [d/type] = "02"
MEMBERSET [d/Position_] = "02"
INTEGER @lv_combi
// //-----------------------------------------------------------------------------------
// //Calculation and Data Writing
// //-----------------------------------------------------------------------------------
FOREACH.BOOKED [d/Position_]
@lv_combi = 0
IF RESULTLOOKUP([d/current_costcenter] = "#") != 0 THEN
@lv_combi = 1
ENDIF
IF @lv_combi = 1 THEN
@lv_combi = 0
FOREACH [d/prior_costcenter]
IF RESULTLOOKUP([d/prior_costcenter] = "#") != 0 THEN
@lv_combi = 1
ENDIF
IF @lv_combi = 1 THEN
DATA([d/type] = "24", [d/Account] = "FTE_prior") = RESULTLOOKUP([d/current_costcenter] = "#", [d/Account] = "FTE_prior")
ENDIF
ENDFOR
ENDIF
ENDFOR
FOREACH.BOOKED [d/Position_]
@lv_combi = 0
IF RESULTLOOKUP([d/prior_costcenter] = "#") != 0 THEN
@lv_combi = 1
ENDIF
IF @lv_combi = 1 THEN
@lv_combi = 0
IF RESULTLOOKUP([d/current_costcenter] = "#") != 0 THEN
@lv_combi = 1
ENDIF
IF @lv_combi = 1 THEN
DATA([d/type] = "23" , [d/Account] = "FTE_current") = RESULTLOOKUP([d/prior_costcenter] = "#", [d/Account] = "FTE_current")
ENDIF
ENDIF
ENDFOR
the result is like
I have added new record type for better analysis . Record type 13 vs 23 and 14 vs 24.
thanks
Dieter
no, because I need to check for each position if this has moved from one cycle to the other, there are around 70k positions, and 4k cost centers. in abap world it would be easy, but with advanced formula i am not yet familiar.....
thanks anyhow.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.