cancel
Showing results for 
Search instead for 
Did you mean: 

Loop in BPC script logic

Former Member
0 Kudos

The *FOR / *NEXT statement is used for loop purpose in BPC script logic, one task we need to achieve is to carry over value from first loop to second loop. for example the following script will loop from Jan to Mar, how could I pass the value e.g. planning amount for Jan to second loop Feb and so on. in ABAP or FOX it's a basic thing done by define a variable and pass that value to the variable, anybody know how to do this in script logic?

*FOR %month% = 2006.JAN, 2006.FEB, 2006.MAR

*NEXT

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

So what you mean is that we cannot pass the value from one loopto next.?

esjewett
Active Contributor
0 Kudos

Hi Jianbai,

BPC script logic FOR/NEXT statements aren't loops in the same sense that ABAP has loops. Instead, what FOR/NEXT does it just copy the text within the loop while replacing values. This done at validation time not at run time.

To see what I mean, create a script logic with a FOR/NEXT loop and validate it, then go into UJFS in BW and find the .LGX file that was generated for your script logic. Download this file and take a look inside of it. You'll see that there are no FOR/NEXT statements anymore, but instead your script logic code will have been expanded to simulate a loop through simple repetition.

In short, you cannot technically do anything in script logic using a FOR/NEXT loop that you can't already do by repeating hardcoded sections of your code.

So, I suggest that you try to create your functionality first without a FOR/NEXT loop at all, and only once you have your functionality working should you add your loops into your code. If you want to post actual sample code showing what you wish to do, I think that would also help us understand what you are trying to accomplish.

Ethan

Former Member
0 Kudos

Hi,

What i mean exactly is that, they BPC scripts execute parallely its not like loop.

Regards,

G.Vijaya Kumar

esjewett
Active Contributor
0 Kudos

Ahhhh, I see that now

My point still is (and this is what I would like Jianbai to try) is that you actually can "pass values" from one part of script logic to another, but you need to commit the values to the database first. So if you write a value in JAN, then *COMMIT, then read that value in order to write another value to FEB, that's very doable.

I'm not sure if this will work for Jianbai or if he is trying to do something else, which is why I would like to see some code with some actual logic and without a FOR/NEXT loop, to clarify things a bit.

Ethan

Former Member
0 Kudos

Hi,

You cant achieve this for big scenario as you need to hard code every thing, like for using the calculated value of Jan in Feb you need to define script for Jan and commit it then define script for Feb to use the calculated value of Jan and so on.

you need to go either by BADI or Excel formulas.

The Script logic exceutes in a parallel fashion, and so the calculated values of previous month cant be used for next time period.

Even Business rules will not help, they to work the same way.

Hope this helps,

Regards,

G.Vijaya Kumar