cancel
Showing results for 
Search instead for 
Did you mean: 

Script - Performance

sap_user62
Active Participant
0 Kudos

Hello Friends,

Env - BPC10.1 on hana

I have a script which mimics fixed amount allocations. The %allocaitons are done using allocation engine script logic as a next steps after fixed amount allocation. The number of records its working with is not very large as we are currently working on shared services allocations only. If we run for the complete shared services functional area, it fails for memory, so we had to slice and run this script for each functional area for shared services, so that we do not run out of memory (even for one month). The script gives correct results.

Now we have a new requirement to do 2 step allocations by including allocations for direct costs too.

Do you advise us to change to a badi, currently our package link has lot of packages as we run the scripts by slice, with the addition of direct cost functions, the slices are going to double.

Its the same for %allocation run using allocation scripts, we have to further slice the selections down and run, due to memory issues.

*SELECT(%Senders%, [ID], SENDER,"[FA]='%FunctionalArea_SET%'")
*XDIM_MEMBERSET TIME = %TimePeriod%
*FOR %Sender% = %Senders%
	*XDIM_MEMBERSET SENDER = %Sender%
	*XDIM_MEMBERSET ACCOUNT = XXXXXXX
	*XDIM_MEMBERSET AUDITTRAIL = AUDIT_DRIVER
	*WHEN CostCenter
	*IS <>%Sender%
		*REC(FACTOR=1, A_ACCOUNT= X, AUDITTRAIL=AUDIT_ALLOCATION)
		*REC(FACTOR=-1, A_ACCOUNT=Y, CostCenter=%Sender%, AUDITTRAIL=AUDIT_ALLOCATION)			
	*ENDWHEN
*NEXT
Thanks for your time
Ed.

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

Theoretically the code has to be:

*SELECT(%Senders%, [ID], SENDER,"[FA]='%FunctionalArea_SET%'")
*XDIM_MEMBERSET TIME = %TimePeriod%
*XDIM_MEMBERSET SENDER = %Senders%
*XDIM_MEMBERSET ACCOUNT = XXXXXXX
*XDIM_MEMBERSET AUDITTRAIL = AUDIT_DRIVER
*WHEN CostCenter
*IS <> SENDER.ID
    *REC(FACTOR=1, A_ACCOUNT= X, AUDITTRAIL=AUDIT_ALLOCATION)
    *REC(FACTOR=-1, A_ACCOUNT=Y, CostCenter=SENDER.ID, AUDITTRAIL=AUDIT_ALLOCATION)
*ENDWHEN

But "*IS <> SENDER.ID" will not work, only "=" is supported. Also the following code with *ELSE is not supported:

*WHEN CostCenter
*IS = SENDER.ID
*ELSE
    *REC(FACTOR=1, A_ACCOUNT= X, AUDITTRAIL=AUDIT_ALLOCATION)
    *REC(FACTOR=-1, A_ACCOUNT=Y, CostCenter=SENDER.ID, AUDITTRAIL=AUDIT_ALLOCATION)
*ENDWHEN

You can do it in 2 steps:

*SELECT(%Senders%, [ID], SENDER,"[FA]='%FunctionalArea_SET%'")
*XDIM_MEMBERSET TIME = %TimePeriod%
*XDIM_MEMBERSET SENDER = %Senders%
*XDIM_MEMBERSET ACCOUNT = XXXXXXX
*XDIM_MEMBERSET AUDITTRAIL = AUDIT_DRIVER
*WHEN CostCenter
*IS * //for all Cost Centers
    *REC(FACTOR=1, A_ACCOUNT= X, AUDITTRAIL=AUDIT_ALLOCATION)
    *REC(FACTOR=-1, A_ACCOUNT=Y, CostCenter=SENDER.ID, AUDITTRAIL=AUDIT_ALLOCATION)
*ENDWHEN

*WHEN CostCenter
*IS = SENDER.ID //Reverse for CostCenter = SENDER.ID
    *REC(FACTOR=-1, A_ACCOUNT= X, AUDITTRAIL=AUDIT_ALLOCATION)
    *REC(FACTOR=1, A_ACCOUNT=Y, CostCenter=SENDER.ID, AUDITTRAIL=AUDIT_ALLOCATION)
*ENDWHEN

Answers (3)

Answers (3)

sap_user62
Active Participant
0 Kudos

Thanks a lot Vadim.

The script that you mentioned above worked well.

I will try to use the same functionality for allocation scripts too. We have to run the runallocations script to small slices to run. It has a similar for loop.

Will create another thread for that.

sap_user62
Active Participant
0 Kudos

Thanks Vadim for your reply.

System Status

CPM BPC 810 0010 SAPK-81010INCPMBPC SAP Business Planning and Consolidation

SAP_BW 740 0015 SAPKW74015 SAP Business Warehouse

Structure of Costcenter - its a dimension in Management Model and Allocation Model

1. Company Code

2. Profit Center

3. Functional Area

Structure of Sender Dimension - its a dimension in Allocation Model only

1. Functional Area

2. Company Code

Sender will have the list of costcenters that need to be allocated.

In essence its like a duplicate dimension of CostCenter. If Costcenter dimension has 5k members, then the Sender will have around 500 cost centers as only those 500 cost centers are involved in allocation process.

When the data moves from Managment to Allocation Model, the sender dimension is mapped to have the same data as Costcenter. After checking the drivers for fixed amounts, the receiver (in this case Costcenter) is allocated the amount. And a reversal is posted in for the sender.

*SELECT(%Senders%,[ID], SENDER,"[FA]='%FunctionalArea_SET%'") - in FunctionalArea we pass each base level member of shared services functional area, to slice the data.

The script looks so simple and it gives intended results, but i guess the "for" loop is eating away the memory.

The script is not run as a part of default logic.

Thanks for your time

Ed.

former_member186338
Active Contributor
0 Kudos

Strange script!

Try to avoid FOR/NEXT... may be using some property...

But please, explain your logic in line with: https://blogs.sap.com/2014/01/31/how-to-ask-questions-about-script-logic-issues/

Detailed info about SENDER and CostCenter dimensions required!