Skip to Content
0
Jan 17, 2020 at 10:33 AM

Trying to avoid FOR/NEXT loop with RUNALLOCATION in script logic

179 Views Last edit Jan 17, 2020 at 10:38 AM 2 rev

Hello Experts.

System versions :

CPMBPC8010018SAPK-80118INCPMBPCCPM Business Planning and Consolidation

SAP_BW7310013SAPKW73113SAP Business Warehouse

Current engine is JAVASCRIPT.

The DM package is called with parameters : MYPHASE = LA10 / MYYEAR=2019 / MANAGERIAL = UK2010

In our BUDGET model we have 12 dimensions, in this issue we will just need to understand the hierarchy for the PRODUCT one (screenshot). Our need is to perform (during a forecast process, forecast called here 'LA10') an allocation of an amount stored against "BRANDTYPE_I" products (the _I means 'Input' to allow input on fake 'parents').

The allocation key to the below level of product (CPL_I) is the weight of product (account T1100) available in BUDGET version.

We do have a working piece of code, but with really bad performance. I'm pretty sure this is due to the *FOR loop.

I've tried to setup something with the *DIM_NONAGGR keyword but member count of WHAT and WHERE is different in that case.

Please kindly advise. Thanks in advance.

(maybe go for a step by step process with WHEN / ENDWHEN syntax, calculate and store an allocation percentage on a tech account, and so on ... ?)

// Allocation to CPL from brandtype

*SELECT(%PROD_BTI%,ID,PRODUCT,LEVEL = BRANDTYPE_I)
*SELECT(%PROD_BT%,ID,PRODUCT,LEVEL = BRANDTYPE)
*SELECT(%PROD_CPLI%,ID,PRODUCT,LEVEL = CPL_I)
*SELECT(%COUNTRYSET%,ID,COUNTRY,CALC = N)

*XDIM_MEMBERSET AUDITTRAIL = INPUT
*XDIM_MEMBERSET CURRENCY = EUROGROUP
*XDIM_MEMBERSET MANAGERIAL = %MANAGERIAL_SET%
*XDIM_MEMBERSET METRICS = VALUE
*XDIM_MEMBERSET PHASE = $MYPHASE$
*XDIM_MEMBERSET TIME = $MYYEAR$.01,$MYYEAR$.02,$MYYEAR$.03,$MYYEAR$.04,$MYYEAR$.05,$MYYEAR$.06,$MYYEAR$.07,$MYYEAR$.08,$MYYEAR$.09,$MYYEAR$.10,$MYYEAR$.11,$MYYEAR$.12
*XDIM_MEMBERSET SOURCING = SOURCINGND
*XDIM_MEMBERSET ENTITY = E999
*XDIM_MEMBERSET FLOW = CLOSING
*XDIM_MEMBERSET ACCOUNT = BAS(R3000) //R2450
*XDIM_MEMBERSET COUNTRY = %COUNTRYSET% //GB

*FOR %loop_BT% = %PROD_BT% //000LABA
	
	*RUNALLOCATION
	*FACTOR = USING/TOTAL
	*DIM_NONAGGR ACCOUNT       WHAT = BAS(R3000) ;    WHERE = <<< ;            USING = T1100 ;     TOTAL = T1100
	*DIM         AUDITTRAIL    WHAT = INPUT ;         WHERE = CALCULATED ;     USING = UPLOADED ;  TOTAL = <<<
	*DIM         PHASE         WHAT = $MYPHASE$ ;     WHERE = <<< ;            USING = <<< ;       TOTAL = <<<
	*DIM         PRODUCT       WHAT = %loop_BT%_I ;   WHERE = BAS(%loop_BT%) ; USING = <<< ;       TOTAL = <<<
	*DIM         CURRENCY      WHAT = EUROGROUP ;     WHERE = <<< ;            USING = LC ;        TOTAL = <<<
	*ENDALLOCATION
*NEXT
*COMMIT

Attachments