Skip to Content
avatar image
Former Member

one Currency to Multiple Currency conversion while Saving budget data

Hi

I need help on currency conversion

my requirement is Users enter Budget data based on selections ENTITY, and "LC(Local currency).

If they enter data in LC then corresponding ENTITY:CURRENCY is taken as Local currency and in Exchange Rate table corresponding exchange rate values need to convert.

Ex:

IN ENTITY DIMENSION

ENTITY : 2200, Currency: SGD

In Rate Model

Category    inputcurrcy     rateentity     rateid     signdata

BUDGET       SGD                CNY          BUD        0.777

BUDGET       SGD                 EUR         BUD        1.7575

BUDGET       SGD                 GLOBAL   BUD       0.656

now user enters budget data in SGD then SGD value need to convert into CNY, EUR and GLOBAL.

this can be dynamic but not hardcoded

I wrote script logic, but it is not working while saving data, my input schedule script logic is in "DEFAULT.LGF"

I hardcoded for GLOBAL then it is working fine, now I want all currencies then script logic is not working

*SELECT(%RT%,"[ID]",INPUTCURRENCY, "[REPORTING]='Y'")

*LOOKUP RATE-BUD

*DIM CATEGORY=BUDGET

*DIM RATEID=BUD

*DIM SOURCECURR:INPUTCURRENCY=ENTITY.CURRENCY

//*DIM TIME=%TIME

*FOR %CUR%=%RT%

*DIM %CUR%:RATEENTITY="%CUR%"

*NEXT

*ENDLOOKUP

*WHEN CURRENCY

*IS LC

*WHEN CATEGORY

*IS BUDGET

*WHEN REVENUE

*IS ASP

*FOR %LOOP_CUR%=%RT%

     *REC(EXPRESSION=%VALUE%

     *LOOKUP(%CUR%),CURRENCY=%CUR%)

*NEXT

*ENDWHEN

*ENDWHEN

*ENDWHEN

I tried for BADI also but couldn't get, can anyone please help me in this regard for multiple currency conversion from one Local Currency

Regards

Silu

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jan 04, 2015 at 04:56 PM

    Hi Silu,

    Can you please explain what does it mean "script is not working"?

    There are number of strange things in your script:

    1. Why do you need SOURCECURR in your LOOKUP if you don't refer to it anywhere? I'd think that line will be ignored when LOOKUP is called.

    2. If you have *FOR %LOOP_CUR%=%RT% then LOOP_CUR should be used in *REC, not CUR.

    Regards,

    Gersh

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi

      I wrote Script logic as I gave below and finally got solved, but it is all hard coded, can any one help me to make it as dynamic, i mean used multiple times WHEN for each currency

      *SELECT(%LCUR%,"[CURRENCY]",ENTITY, ID=%ENTITY_SET%)

      *LOOKUP RATE-BUD

      *DIM CATEGORY=BUDGET

      *DIM RATEID=BUD

      *DIM SOURCECURR1:RATEENTITY=%LCUR%

      *DIM SOURCECURR1:INPUTCURRENCY=CNY

      *DIM SOURCECURR2:RATEENTITY=%LCUR%

      *DIM SOURCECURR2:INPUTCURRENCY=EUR

      *DIM SOURCECURR3:RATEENTITY=%LCUR%

      *DIM SOURCECURR3:INPUTCURRENCY=HKD

      *DIM SOURCECURR4:RATEENTITY=%LCUR%

      *DIM SOURCECURR4:INPUTCURRENCY=JPY

      *DIM SOURCECURR5:RATEENTITY=%LCUR%

      *DIM SOURCECURR5:INPUTCURRENCY=SGD

      *DIM SOURCECURR6:RATEENTITY=%LCUR%

      *DIM SOURCECURR6:INPUTCURRENCY=USD

      *DIM SOURCECURR7:RATEENTITY=GLOBAL

      *DIM SOURCECURR7:INPUTCURRENCY=%LCUR%

      *ENDLOOKUP

      *WHEN CURRENCY

      *IS CNY

      *WHEN CATEGORY

      *IS BUDGET

      *WHEN REVENUE

      *IS ASP

      *REC(EXPRESSION=%VALUE%*LOOKUP(SOURCECURR1),CURRENCY=%LCUR%)

      *ENDWHEN

      *ENDWHEN

      *ENDWHEN

      *WHEN CURRENCY

      *IS EUR

      *WHEN CATEGORY

      *IS BUDGET

      *WHEN REVENUE

      *IS ASP

      *REC(EXPRESSION=%VALUE%*LOOKUP(SOURCECURR2),CURRENCY=%LCUR%)

      *ENDWHEN

      *ENDWHEN

      *ENDWHEN

      *WHEN CURRENCY

      *IS HKD

      *WHEN CATEGORY

      *IS BUDGET

      *WHEN REVENUE

      *IS ASP

      *REC(EXPRESSION=%VALUE%*LOOKUP(SOURCECURR3),CURRENCY=%LCUR%)

      *ENDWHEN

      *ENDWHEN

      *ENDWHEN

      *WHEN CURRENCY

      *IS JPY

      *WHEN CATEGORY

      *IS BUDGET

      *WHEN REVENUE

      *IS ASP

      *REC(EXPRESSION=%VALUE%*LOOKUP(SOURCECURR4),CURRENCY=%LCUR%)

      *ENDWHEN

      *ENDWHEN

      *ENDWHEN

      *WHEN CURRENCY

      *IS SGD

      *WHEN CATEGORY

      *IS BUDGET

      *WHEN REVENUE

      *IS ASP

      *REC(EXPRESSION=%VALUE%*LOOKUP(SOURCECURR5),CURRENCY=%LCUR%)

      *ENDWHEN

      *ENDWHEN

      *ENDWHEN

      *WHEN CURRENCY

      *IS USD

      *WHEN CATEGORY

      *IS BUDGET

      *WHEN REVENUE

      *IS ASP

      *REC(EXPRESSION=%VALUE%*LOOKUP(SOURCECURR6),CURRENCY=%LCUR%)

      *ENDWHEN

      *ENDWHEN

      *ENDWHEN

      *WHEN CURRENCY

      *IS LC

      *WHEN CATEGORY

      *IS BUDGET

      *WHEN REVENUE

      *IS ASP

      *REC(EXPRESSION=%VALUE%*LOOKUP(SOURCECURR7),CURRENCY=GC)

      *ENDWHEN

      *ENDWHEN

      *ENDWHEN

      *COMMIT

      Regards

      Silu