on 01-04-2017 4:17 PM
Hi,
I a trying to do a currency conversion using lookup, the value is halved and translation is applied. below is the simple code.
*LOOKUP Rates
*DIM END:R_ACCOUNT = END
*DIM CATEGORY = Actual
*DIM R_ENTITY = Global
*DIM INPUTCURRENCY = ENTITY.CURRENCY
*ENDLOOKUP
*XDIM_MEMBERSET RPTCURRENCY = LC
*XDIM_MEMBERSET CATEGORY = Actual
*WHEN RPTCURRENCY
*IS LC
*REC(EXPRESSION = %VALUE%/LOOKUP(END),RPTCURRENCY = USD)
*ENDWHEN
*COMMIT
2015.11LC - LCUSD - USD105.3084192
Please test exactly this script (please check that you have nothing else in default.lgf):
*LOOKUP Rates
*DIM R_ACCOUNT = END
*DIM R_ENTITY = Global
*DIM LC_RATE:INPUTCURRENCY = ENTITY.CURRENCY
*DIM USD_RATE:INPUTCURRENCY=USD
*ENDLOOKUP
*WHEN CATEGORY
*IS Actual
*WHEN RPTCURRENCY
*IS LC
*REC(EXPRESSION = %VALUE%*LOOKUP(USD_RATE)/LOOKUP(LC_RATE),RPTCURRENCY = USD)
*ENDWHEN
*ENDWHEN
Also please list dimensions you have in the rate model!
Corrected - *DIM R_ENTITY = Global
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Below is the screen shot of the currency property of AGB01
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Below are the values from Rates model
And in my finance model, I am inputting a value of 10 in LC (for the entity AGB01 the rptcurrency is EUR) as the currency conversion is written in default I am expecting 10 EUR = 10.616 USD which is derived as (10*1/.9419). Kindly let me know if any more information is need to get clarity.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
when I used the recommended code the value is doubled.
*LOOKUP Rates
*DIM R_ACCOUNT = END
*DIM CATEGORY = Actual
*DIM R_ENTITY = Global
*DIM LC_RATE:INPUTCURRENCY = ENTITY.CURRENCY
*FOR %CUR%=USD //list of target currencies
*DIM %CUR%_RATE:INPUTCURRENCY=%CUR%
*NEXT
*ENDLOOKUP
*XDIM_MEMBERSET RPTCURRENCY = LC
*XDIM_MEMBERSET CATEGORY = Actual
*WHEN RPTCURRENCY
*IS *
*REC(EXPRESSION = %VALUE%*LOOKUP(USD_RATE)/LOOKUP(LC_RATE),RPTCURRENCY = USD)
//*REC(EXPRESSION = %VALUE%/LOOKUP(LC_RATE),RPTCURRENCY = USD)
*ENDWHEN
the expected value is 10.61 USD.
When I used :*REC(EXPRESSION = %VALUE%/LOOKUP(LC_RATE),RPTCURRENCY = USD) the value is halved
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, but please provide the clear test case, I am unable to understand what are you doing!
Please read again: https://blogs.sap.com/2014/01/31/how-to-ask-questions-about-script-logic-issues
Provide report for rate model! With all members clearly shown! (EUR,USD)
Also, if you want to use script in default.lgf then remove XDIM_MEMBERSET!
// delete *XDIM_MEMBERSET RPTCURRENCY = LC
// delete *XDIM_MEMBERSET CATEGORY = Actual
*WHEN CATEGORY
*IS Actual
*WHEN RPTCURRENCY
*IS LC
...
The script to convert to any currency will be like:
*LOOKUP Rates
*DIM R_ACCOUNT = END
*DIM CATEGORY = Actual
*DIM R_ENTITY = Global
*DIM LC_RATE:INPUTCURRENCY = ENTITY.CURRENCY
*FOR %CUR%=EUR,USD //list of target currencies
*DIM %CUR%_RATE:INPUTCURRENCY=%CUR%
*NEXT
*ENDLOOKUP
*XDIM_MEMBERSET RPTCURRENCY = LC
*XDIM_MEMBERSET CATEGORY = Actual
*WHEN RPTCURRENCY
*IS *
*REC(EXPRESSION = %VALUE%*LOOKUP(USD_RATE)/LOOKUP(LC_RATE),RPTCURRENCY = USD)
*ENDWHEN
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please provide complete info inline with https://blogs.sap.com/2014/01/31/how-to-ask-questions-about-script-logic-issues/
From your code:
*DIM INPUTCURRENCY = ENTITY.CURRENCY
will get rate for the currency defined in ENTITY property CURRENCY
Why do you think it will be USD or ...?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.