cancel
Showing results for 
Search instead for 
Did you mean: 

how we can avoid Loop in this calc case?

former_member187400
Active Contributor
0 Kudos

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 2015201620172018
10010115151515
10010220202020
10010330303030

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.

Accepted Solutions (1)

Accepted Solutions (1)

former_member194957
Active Participant
0 Kudos

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.

former_member187400
Active Contributor
0 Kudos

Hello Tharun -

The expected Account 100104 will be like this:

Account201520162017
100104656565


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



I will try and revert back to you,


Many thanks,


Cheers,

former_member187400
Active Contributor
0 Kudos

Many thanks Tharun for your help. 

Answers (1)

Answers (1)

federico_blarasin
Active Participant
0 Kudos

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.

former_member187400
Active Contributor
0 Kudos

thanks you Federico.