Former Member

### FOX FORMULA..

Hi All ,,

i want to change exchange rate and type of currency with fox formulas. i did one but it didn't work correctly.i have two cdata cubes which are SALE Cube and PARAMETER Cube and i have multi-provider that include these cubes.i calculated Net Revenue but i didn't calculate change exchange rate and type of currency.i must change exchange rate according to Monthly Average Exchange Rate which is in PARAMETER Cube and others(net revenue and gross revenue and discounts) are in SALE Cube.i carried out this formula and it is true but it didn't produce records.The formula below:

```*DMSAT04 Net Revenue.
*DMSAT03 Gross Revenue.
*DMSAT05 Discounts.

DATA CUR TYPE 0CURRENCY.
DATA CURT TYPE 0CURTYPE.

FOREACH CUR,CURT IN SELECTION.
IF NOT CUR IS INITIAL.
IF NOT CURT IS INITIAL.
{ DMSAT04,CUR,00}={ DMSAT03,CUR,00}-{ DMSAT05,CUR,00}.
IF CURT=10.
{ DMSAT04,TRY,10}=({ DMSAT04,TRY,00}+
({ DMSAT04,EUR,00}*{DMSAT07,EUR,#})+
({ DMSAT04,USD,00}*{DMSAT07,USD,#})).
ELSEIF CURT=20.
{ DMSAT04,EUR,20}={ DMSAT04,TRY,10}*{DMSAT07,EUR,#}.
ELSEIF CURT=30.
{ DMSAT04,EUR,20}={ DMSAT04,TRY,10}*{ DMSAT07,USD,#}.
ENDIF.
ENDIF.
ENDIF.
ENDFOR.
```

10|10000 characters needed characters exceeded

• May 14, 2011 at 03:18 PM

Hello,

you use FOREACH ... IN SELECTION. Check that 0CURRENCY and 0CURTYPE are restricted properly in the filter you use.

Test with something small. Then add more logic. Does this work for example?

```DATA CUR TYPE 0CURRENCY.

FOREACH CUR.
IF NOT CUR IS INITIAL.
{ DMSAT04,CUR,00}={ DMSAT03,CUR,00}-{ DMSAT05,CUR,00}.
ENDIF.
ENDFOR.```

Finally, test the function as a sequence in the planning modeler. This way you can better see what data is selected and how it's processed.

Regards,

Marc

SAP Techology RIG