cancel
Showing results for 
Search instead for 
Did you mean: 

Multi-part conditionals in BPC Logic Script

former_member277290
Participant
0 Kudos

Hi folks.

I am attempting to improve some code. I have searched around and can't seem to find exactly what I'm looking for, so thought I'd put it up here for the good of the public.

I have some logic (represented below generically by <DO SOMETHING>) which I want to perform, except for a specific pairing of ENTITY and INTERCO groupings.
Let's say: Entities with property X with Interco property Y, or Entity property Y with Interco property X.

I do not like the structure below, due to the repetition of the same code block. So...

Q1:
Could we use AND (&&) and OR (||) operators to combine the conditions into a single chunk?

Q2:
Alternatively, is there a way to exit the execution of script logic early? Something like a *QUIT or *EXIT, which would prevent any subsequent execution of commands upon being reached?

Q3:
Do you have any suggestions for other approaches which would work?

*WHEN ENTITY.PROPERTY

*IS X

    *WHEN INTERCO.PROPERTY

    *IS <> Y

        <DO SOMETHING>

    *ENDWHEN

*IS Y

    *WHEN INTERCO.PROPERTY

    *IS <> X

        <DO THE SAME THING>

    *ENDWHEN

*ELSE

    <DO THE SAME THING>

*ENDWHEN

For further information, this is on BPC for Microsoft, 10.1.

Looking forward to hearing your responses.
Kind Regards,

-Elliott

Accepted Solutions (1)

Accepted Solutions (1)

former_member277290
Participant
0 Kudos

Update: After reading the help guide, which was actually quite useful, and some experimentation, it turns out that the use of *SUB()/*ENDSUB does exactly what I was asking, in terms of re-useable code blocks. This allowed me to write the core logic once and call it multiple times.

Answers (2)

Answers (2)

former_member186338
Active Contributor
0 Kudos

First:

"For further information, this is on BPC for Microsoft, 10.1."

Please remove INCORRECT tag

SAP Business Planning and Consolidation, version for SAP NetWeaver

Script logic is absolutely different between MS and NW BPC

P.S. For BPC NW you can use *ELSE for other values. Please read help.

former_member277290
Participant
0 Kudos

Hi Vadim, thanks for your response.

Given the scenario posed above, do you think the code as posted is optimal? Or do you see any ways to improve it?

I am aware that there are many differences between the two platforms, but would rather have more people familiar with logic script potentially contributing to an answer that is potentially useful to everybody, rather than cutting the audience in half. The nature of the question is on structuring logic flow to avoid redundancy.

Are you suggesting that *ELSE is not available in both MS and NW versions? As far as I can see, the only reference on the matter is this post from James Lin several years ago, which does not mention *ELSE although I assume it is covered by the *WHEN/*ENDWHEN block which is available in both.

"Please read help"

What help are you referring to? To quote Vadim Kalinin from this thread:
"As far as I know, you will not find a 'proper, up-to-date, comprehensive manual'. In each SP some statements are changed. The help is not updated in time..."

Apologies if I'm missing something obvious here, but after a day or two searching through SAP Help and forums, I have not found a useful answer. Otherwise I would not be asking a new question here.


former_member186338
Active Contributor
0 Kudos

First of all - open help for BPC MS:

https://help.sap.com/viewer/ac22cb71e63345288987c4facb96861d/10.1/en-US/a5719a63b6fa4ef0964d11d69c60...

ELSE is supported.

Logic scripts are ABSOLUTELY different in 2 platforms (even some keywords are same) and the person with experience in BPC NW can't help you!

former_member277290
Participant
0 Kudos

Thank you for pointing me to the BPC MS Help area, that is genuinely useful.

As you can see, I am already using *ELSE in the code I originally posted.
The point I am making is, although there are vast differences between the two platforms, if the helpful answer is something shared, like "Use *ELSE" , that answer could have been contributed by anybody, irrespective of platform.

It seems as though *INCLUDE can be used to condense the repeated logic above. Is it valid to use *INCLUDE for a repeated snippet in this way?

former_member186338
Active Contributor
0 Kudos

INCLUDE will simply insert a text block - useless in this case and will require extra processing!

It's better to repeat code 3 times.

Script logic is not a real programming language it's just some text processing...

former_member277290
Participant
0 Kudos

Thanks - would you say the same thinking applies to

*SUB and *FUNCTION? Would you advise against using those in favour of repeating the same core logic multiple times? Is the only drawback longer processing time while it prepares the text file to run through?

Otherwise, I will experiment with all three of these and see
a) Whether they are behaving as I hope, and
b) What the performance implications are
If I find anything interesting I will report back as an answer to this thread.

0 Kudos

Hi Elliot.

For your specific example, create a property on ENTITY called "IC" (or however you want to call it) and maintain in it the INTERCO ID which the code should not apply.

Then implement the next code:

*WHEN INTERCO
*IS <> ENTITY.IC

<DO SOMETHING>

*ENDWHEN

Drawback: It will only work for a single INTERCO for each ENTITY.

I haven't tried it, but I think it should work.

Best regards,

Joaquín.

former_member277290
Participant
0 Kudos

Hi Joaquín,

Unfortunately my situation is indeed the case in your 'drawback' note.
I simplified it somewhat for presentation above. It is actually all entities with a certain property, which I want to match off against all intercompanies of a different property. So there are multiple possible pairings.
If you replace 'INTERCO' with 'INTERCO.PROPERTY' and ENTITY with 'ENTITY.PROPERTY' above that is the real situation we have here, so I am more concerned with the structure of the logic itself.

Kind Regards,

-Elliott

0 Kudos

"(...) which I want to match off against all intercompanies of a different property. So there are multiple possible pairings."

Sorry, I don't understand that part...

And under your own definition... does this work?

*WHEN ENTITY.PROP
*IS <> INTERCO.PROP

...

*ENDWHEN

Im talking in a NW scenario. I have no experience in MS installation.

Best regards,

Joaquín.

former_member277290
Participant
0 Kudos

Yes, syntax like ENTITY.PROP IS <> INTERCO.PROP should work in both MS and NW. My only concern really was about the redundancy of writing and maintaining the same block of code multiple times within one script.
After looking into it a little more I will be experimenting with INCLUDE / SUB / FUNCTION to see if that will allow me to reference a single block multiple times.

Thanks for your comments all the same.