Skip to Content

how we can avoid Loop in this calc case?

Hello All -

We are working in BW 7.5 SP03.

We are planning to give an access to the superuser to create the formula in FOX. However, we tried to give the FOX template for the to create the Formula. In the FOX template, we are longing for the superuser only maintain:
{AMOUNT, ACCOUNT}.

However, if our BPC Input is like below -

Account 2015201620172018100101151515151001022020202010010330303030

My understanding is we need to use FOREACH and YEAR.

e.g.

DATA V_YEAR TYPE 0FISCYEAR.

FOREACH V_YEAR.

{AMOUNT, V_YEAR, 100104} = {AMOUNT, V_YEAR, 100101} + {AMOUNT, V_YEAR, 100102} + {AMOUNT, V_YEAR, 100103} .

ENDFOR.

We found that it's to difficult for the user. We want to avoid FOREACH, and YEAR. We only want user to enter ACCOUNT, and AMOUNT so it will be like that:

{AMOUNT, 100104} = {AMOUNT, 100101} + {AMOUNT, 100102} + {AMOUNT, 100103} .


Do you have any advice how we can achieve that?

Many thanks,
Daniel.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jun 27, 2016 at 10:44 AM

    Hi Daniel N,

    Try this and let me know..

    Is it like you are not interested in using any Looping statements or only FOREACH. Also according to the second statement without year in the operands list, the

    Amount will be aggregated as a whole i.e..

    there is a chance like

    {AMOUNT,100104} = 60 + 80 +120 = 260. (is this the expected output?)

    If not,You can also try choosing 0FISCYEAR in the fields for conditions and specify the year (if its okay to be hardcoded ) or you can use a variable to get the input from the user at runtime for year. Later use the year like

    IF YEAR = VARV(user_input).

    {AMOUNT,.. } = sum of amounts.

    ENDIF.

    Hope this helps.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 28, 2016 at 03:25 PM

    Hello Daniel,

    it really depends if you add the year in the characteristics to be changed or not (in the parameters section).

    -If you do NOT add the year, you will have {0AMOUNT, 0ACCOUNT} to maintain, and you can use the code as in your example {AMOUNT, 100104} = {AMOUNT, 100101} + {AMOUNT, 100102} + {AMOUNT, 100103} .

    The system will automatically executes this function for every year in the selection.

    -If you add the year in the characteristics to be changed, you will have {0AMOUNT,0FISCYEAR,0ACCOUNT} to maintain, and in that case you need to use a loop on the year.

    If you don't need to compare different years, just keep it simple and write your code without the loop.

    Add a comment
    10|10000 characters needed characters exceeded

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.