Skip to Content
author's profile photo Former Member
Former Member

Problem with BPS Fox with If-Clause and Foreach-Loop

Hi folks,

I'm facing an issue with SEM-BPS Fox coding:

Operand display:

{Key Figure Name,Cost component,Version,Value type,Reposting version}

Coding:

DATA CSTCOMP TYPE 0CSTCOMP.

DATA VERS TYPE 0VERSION.

IF {ZPROVERT,#,ADB,010,1} = 0.

EXIT.

ELSE.

FOREACH CSTCOMP.

FOREACH VERS.

IF {0AMOUNT,CSTCOMP,VERS,070,2} <> 0.

{0AMOUNT,CSTCOMP,VERS,070,2}=0.

ENDIF.

ENDFOR.

ENDFOR.

ENDIF.

The problem is as follows:

The IF-clause (with FOREACH-loop commented out) works fine.

Also the FOREACH-loop (if the IF-clause is commented out) works also fine.

But both together - it doesn't work (means no records are generated).

The reason is coming somehow from the packaging in the memory during execution (after we did some debugging here - screenshot has been attached).

The system cannot have different parameters in the IF-clause (Cost component = #, Version = ADB) compared to the parameters which result from the loop.

Do you have any idea, if this can be solved somehow?

Regards,
Christoph

debugging.jpg (202.7 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Mar 16, 2015 at 08:37 AM

    Hi Christoph,

    your first IF statement and the statement within the foreach loop have nothing to do with each other. So it does not make any sense to try to combine them in one formula.

    What is the reason of that first statement?

    Do you want to exclude a certain version or customer?

    Probably it would be better to do this with the filter (I think it was planning package in BPS).

    regards

    Cornelia


    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Christoph,

      well if the data record that you want to check is so very much different - is it really only one recordwhere you can identify the char that differ with one key per char?

      Because then you can define that record as a reference data record.

      take only the char that are really changing into your formula.

      then define

      data check = F.

      check = {key figure,... (all the chars that remain as to be changed I reference char}

      don´t write it manually, use the help functionality to define reference characteistics. I don´t really remember how it looked like in BPS, but there should be a button or something where you get help about how to build up the tuples.

      this reference data record will be read for each of the packages.

      otherwise yes an exit would do.

      regards

      Cornelia

  • Posted on Mar 19, 2015 at 04:36 PM

    Hi,

    I have general question :

    Why:

    If {...} = 0.

    exit.

    else.

    ..

    do something

    ..

    endif.

    instead of:


    if {..} <> 0.

    ..

    do something e.g message I'm inside "If"

    ..

    endif.


    save some bytes for The Planet 😊


    Make a simple check using message weather you will be inside this IF at all.

    If not you probably don't have {ZPROVERT,#,ADB,010,1} <> 0 in the current context. Trace each package for such a value to be sure.


    From my experience it can happen when ZPROVERT is a currency od quantity and you don't have unit or currency unit in your changeable operands


    Regards


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Adam,

      thanks a lot for your answer!

      We tried out almost everything, including your proposal.

      The system is validating our IF-clause and it's working - we saw it from the messages shown.

      What I have written to Cornelia before, was, that the system creates different iterations for the IF-clause and the FOREACH-loop, that's why it's not working in that way.

      ZPROVERT is a quantity with a fixed quantity unit "%".

      0AMOUNT is a value field, linked to the 0CURRENCY key.

      I'll try to have the currency key in the changeable operands.

      Maybe your hint is solving the issue somehow.

      Regards,

      Christoph

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.