Skip to Content

Multi-part conditionals in BPC Logic Script

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Aug 30, 2017 at 12:31 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 22, 2017 at 02:44 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • Aug 23, 2017 at 11:44 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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.