Skip to Content
0
Nov 22, 2020 at 04:50 PM

BPC Script Logic - Long Run Time

91 Views Last edit Nov 23, 2020 at 02:38 AM 2 rev

Hello experts! I am new to BPC and encountered a 1x hours run time when executing the script logic. Please take a look at the details and any help will be really appreciated! Thank you very much for your time and help in advance!

Purpose & Issue encountered:

As we are working on the cost allocation exercise, the purpose of the logic script is to retrieve the ratio from the ratio table (RATIO_ALC) to the transaction table (TRANS_ALC), to calculate the cost allocated to the subsequent flows and writes back the calculated result to TRANS_ALC.

So a script has been developed based on the requirement and it works perfectly well in testing when the executing volume is low, say 20 entries. But when it comes to full loops for all required items, it took around 13 hours to complete.

I have tried implementing badi RUNLOGIC_PH (https://archive.sap.com/documents/docs/DOC-35152) but failed to import the transport, and I suspect that it is a result of versioning issue. These lead to my questions:

  1. Does RUNLOGIC_PH still applicable for BW4 (my version)?
  2. Is there anything I can do with my script to ease the problem?
  3. Is there any other thing I should/ can consider? any recommendations?

Version:

[BPC 11.1] BPC4HANA 200 SP 4, BW4HANA 200 SP 4 ABAP

Model details:

TRANS_ALC

  • CATEGORY(C)
  • COSTCENTER_BU(U)
  • COSTCENTER_DEPT(U)
  • DATASOURCE(D)
  • DID(U)
  • ENTITY(E)
  • FLOW_ALC(S)
  • GLACCOUNT(A)
  • PROFITCENTER(U)
  • RPTCURRENCY(R)
  • TIME(T)
  • YEAROFPLAN(U)
  • ACQMAINT(U)

RATIO_ALC

  • CATEGORY(C)
  • COSTCENTER_BU(U)
  • COSTCENTER_DEPT(U)
  • COSTCENTER_SDEPT(U)
  • DATASOURCE(D)
  • ENTITY(E)
  • FLOW_ALC(S)
  • GLACCOUNT(A)
  • PROFITCENTER(U)
  • RPTCURRENCY(R)
  • TIME(T)
  • YEAROFPLAN(U)
  • ACQMAINT(U)

Script:

PS. User does not expect to select DEPT, BU, or GLACCOUNT information when executing the logic.

*SELECT (%DEPT_CC%, ID, COSTCENTER_DEPT, NATURE = DEPT)
*SELECT (%BU_CC%, ID, COSTCENTER_BU, NATURE = BU)
*SELECT (%COA%, ID, GLACCOUNT, GAE_OAC_AC <>'')

// TRANS_ALC Memberset
*XDIM_MEMBERSET YEAROFPLAN = 2019 //%YEAROFPLAN_SET%
*XDIM_MEMBERSET TIME = 2019.01 //%TIME_SET%
*XDIM_MEMBERSET PROFITCENTER = NA
*XDIM_MEMBERSET MEASURES = PERIODIC
*XDIM_MEMBERSET RPTCURRENCY = HKD
*XDIM_MEMBERSET ACQMAINT = NA
*XDIM_MEMBERSET FLOW_ALC = STEP_B
*XDIM_MEMBERSET CATEGORY = BUDGETV1 //%CATEGORY_SET%

// RATIO_ALC LOOKUP ratio
*LOOKUP RATIO_ALC
	*DIM GLACCOUNT = NA
	*DIM FLOW_ALC = STEP_C
	*DIM DATASOURCE = Input
	*FOR %LOOP_DEPT_CC% = %DEPT_CC%
		 *FOR %LOOP_BU_CC% = %BU_CC%
			*DIM R_%LOOP_DEPT_CC%_%LOOP_BU_CC%: COSTCENTER_DEPT = %LOOP_DEPT_CC%
			*DIM R_%LOOP_DEPT_CC%_%LOOP_BU_CC%: COSTCENTER_BU = %LOOP_BU_CC%
		 *NEXT
	*NEXT
*ENDLOOKUP

// TRANS_ALC Action
*FOR %LOOP_COA% = %COA%
	*WHEN GLACCOUNT
		*IS %LOOP_COA%
		*FOR %LOOP_DEPT_CC% = %DEPT_CC%
			*WHEN COSTCENTER_DEPT
				*IS %LOOP_DEPT_CC%
				*FOR %LOOP_BU_CC% = %BU_CC%
					*REC(EXPRESSION = 0, FLOW_ALC = "STEP_C")
					*REC(FACTOR = LOOKUP(R_%LOOP_DEPT_CC%_%LOOP_BU_CC%)*-1,FLOW_ALC = "STEP_C", COSTCENTER_DEPT = %LOOP_DEPT_CC%)
					*REC(FACTOR = LOOKUP(R_%LOOP_DEPT_CC%_%LOOP_BU_CC%),FLOW_ALC = "STEP_C", COSTCENTER_BU = %LOOP_BU_CC%)
				*NEXT
			*ENDWHEN
		*NEXT
	*ENDWHEN
*NEXT