cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BPC Logic Script Taking too long to run

0 Kudos
165

Hello,

so I have the following script

*XDIM_MEMBERSET ZACCOUNTS = 101, 102, 103, 201, 202, 203, 301, 302, 303
*XDIM_MEMBERSET ZMISC = 4000, 2000
*XDIM_MEMBERSET CATEGORY = Budget
*XDIM_MEMBERSET ZCOD = 1000

*WHEN ZMISC
*IS 2000
*REC(EXPRESSION=(0), ZMISC = 2000)
*ENDWHEN

*FOR %PER% = 2020.01, 2020.02, 2020.03, 2020.04, 2020.05, 2020.06, 2020.07, 2020.08, 2020.09, 2020.10, 2020.11
*XDIM_MEMBERSET TIME = %PER%

*WHEN ZMISC
*IS 4000
*REC(EXPRESSION=([TIME].[2020.USE]), ZMISC = 4000)
*ENDWHEN

*WHEN ZMISC
*IS 2000
*REC(EXPRESSION=([ZMISC].[3000]/([ZMISC].[4000] * 12) + %VALUE%), ZMISC = 2000)
*ENDWHEN

*WHEN TIME
*IS %PER%
*REC(EXPRESSION=([ZMISC].[2000]/2), TIME = TMVL(1,%PER%), ZMISC = 2000)
*ENDWHEN

*WHEN ZMISC
*IS 4000
*REC(EXPRESSION=(0), ZMISC = 4000)
*ENDWHEN

*NEXT

And it is taking up to 40 seconds to run, is there a way to optimize it without ruining the core function of it? i've tried everything and nothing works =/

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

First of all, please read: https://blogs.sap.com/2014/01/31/how-to-ask-questions-about-script-logic-issues/

In order to optimize script the detailed information is required!

Second:

In general, the issue of this script is FOR/NEXT! And you are using FOR/NEXT because you have TMVL(1,%PER%) as target TIME member.

It's better to add property in the TIME dimension like: NEXTPERIOD and fill it:

ID       NEXTPERIOD
2020.01  2020.02
2020.02  2020.03
...

Then you can use it in the script:

*REC(EXPRESSION=([ZMISC].[2000]/2), TIME = TIME.NEXTPERIOD, ZMISC = 2000)

And you can avoid FOR/NEXT!

But the rest of your script is strange and has to be also corrected!

Answers (0)