on 2019 Apr 24 10:17 AM
Hello BPC gurus,
The below script working as expected, If I select one month (Ex 01.2018) time period and run the package, the currency conversion based on last year same month (Ex 01.2017) rate conversion. The results are wrong, If I select 12 moths periods (Ex 01.2018 to 12.2018)at a time and execute the package the currency conversion is taking place on 12 months back period(Ex 01.2017). The requirement is to check the conversion factor for previous 12 months for each period even user select multiple months. Ex : If user selects three months 01.2018, 02.2018, 03.2018 the rate conversion should based on 01.2017, 02.2017, 03.2017. I am new to Script logic and don't know how to declare and introduce FOR loop in below script to achieve desired results.
The version is BPC 10 Netweaver
Please help me.
Krishna
*SELECT(%VERSION_LIST%,FX_SOURCE_CATEGORY,VERSION,ID=%VERSION_SET%)
*LOOKUP RATE
*DIM TIME = TMVL(-12,%TIME_SET%)
*DIM R_ENTITY = "GLOBAL"
*DIM VERSION=%VERSION_LIST%
*DIM R_ACCT = SUMMARY_ACCOUNT.RATETYPE
*DIM LKPLC:INPUTCURRENCY = E_ENTITY.CURRENCY
*DIM LKPSUB:INPUTCURRENCY = E_ENTITY.SUBMISSION_CURRENCY
*ENDLOOKUP
*XDIM_MEMBERSET E_ENTITY = BAS(%E_ENTITY_SET%)
*XDIM_MEMBERSET TIME = BAS(%TIME_SET%)
*WHEN RPTCURRENCY
*IS Subm
*WHEN E_ENTITY.SUBMISSION_CURRENCY
*IS <> ""
*WHEN SUMMARY_ACCOUNT.RATETYPE
*IS <> ""
*REC(EXPRESSION = %VALUE%*LOOKUP(LKPSUB),RPTCURRENCY = USD)
*ELSE
*REC(FACTOR=1,RPTCURRENCY = USD)
*ENDWHEN
*ENDWHEN
*ENDWHEN
Request clarification before answering.
Your issue is related to TMVL function and LOOKUP in general...
*DIM TIME = TMVL(-12,%TIME_SET%)TMVL from multiple months containing in %TIME_SET% will result in TMVL(-12, <lowest month in %TIME_SET%>)
For example: %TIME_SET%=01.2018, 02.2018, 03.2018
Then: TMVL(-12,%TIME_SET%) = 01.2017
"variables, like %TIME_SET%
The first period of the TIME_SET is used as the base period for a negative offset and the last period of the TIME_SET is used as the base period for a positive offset."
In order to work with multiple months in %TIME_SET% you have to create a property in TIME dimension like PREVYEARMONTH and fill it:
01.2018 - 01.2017
02.2018 - 02.2017
...
Then you can use:
*DIM TIME = TIME.PREVYEARMONTH Time member for LOOKUP will be selected based on the property.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This code:
*SELECT(%VERSION_LIST%,FX_SOURCE_CATEGORY,VERSION,ID=%VERSION_SET%)
*LOOKUP RATE
*DIM TIME = TIME.PREVYEARMONTH
*DIM R_ENTITY = "GLOBAL"
*DIM VERSION=%VERSION_LIST%
*DIM R_ACCT = SUMMARY_ACCOUNT.RATETYPE
*DIM LKPLC:INPUTCURRENCY = E_ENTITY.CURRENCY
*DIM LKPSUB:INPUTCURRENCY = E_ENTITY.SUBMISSION_CURRENCY
*ENDLOOKUP
*XDIM_MEMBERSET E_ENTITY = BAS(%E_ENTITY_SET%)
*XDIM_MEMBERSET TIME = BAS(%TIME_SET%)
*WHEN RPTCURRENCY
*IS Subm
*WHEN E_ENTITY.SUBMISSION_CURRENCY
*IS <> ""
*WHEN SUMMARY_ACCOUNT.RATETYPE
*IS <> ""
*REC(EXPRESSION = %VALUE%*LOOKUP(LKPSUB),RPTCURRENCY = USD)
*ELSE
*REC(FACTOR=1,RPTCURRENCY = USD)
*ENDWHEN
*ENDWHEN
*ENDWHENIs OK!
LOOKUP/ENDLOOKUP - is a definition, not a directly executed code.
LOOKUP will be executed at each iteration of WHEN/ENDWHEN loop with current members of WHEN/ENDWHEN loop passed to LOOKUP.
In this case we can look on E_ENTITY and TIME
If current member of TIME in WHEN/ENDWHEN is 2019.02 then LOOKUP will get data from 2018.02 stored in PREVYEARMONTH property of 2019.02
Hope it's clear!
Try to execute script in UJKT
P.S. Same approach with E_ENTITY
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vadim Kalinin,
Thanks for the inputs. I will test above code.
But I realised that One of property RATE_YEAR is available for dimension "Version" (
Version is Catogory dimension )and kept the value as "-1".
Based on this property, the exchange rates should read from previous year.
But the property RATE_YEAR is not picking the previous year exchange rates. shall it require to explictly mention RATE_YEAR property in my code to work or will it read the property without coding.
My above query was related to my original query but not related with alternative solution (New property creation)
The Original code again:
*LOOKUP RATE
//*DIM TIME = TMVL(-12,%TIME_SET%)
*DIM TIME = TIME.ID
*DIM R_ENTITY = "GLOBAL"
*DIM VERSION=%VERSION_LIST%
*DIM R_ACCT = SUMMARY_ACCOUNT.RATETYPE
*DIM LKPLC:INPUTCURRENCY = E_ENTITY.CURRENCY
*DIM LKPSUB:INPUTCURRENCY = E_ENTITY.SUBMISSION_CURRENCY
// Shall I require to add here RATE_YEAR property for VERSION to get
// Previous year exchange rate.
*ENDLOOKUP
*XDIM_MEMBERSET E_ENTITY = BAS(%E_ENTITY_SET%)
*XDIM_MEMBERSET TIME = BAS(%TIME_SET%)
*WHEN RPTCURRENCY
*IS Subm
*WHEN E_ENTITY.SUBMISSION_CURRENCY
*IS <> ""
*WHEN SUMMARY_ACCOUNT.RATETYPE
*IS <> ""
*REC(EXPRESSION = %VALUE%*LOOKUP(LKPSUB),RPTCURRENCY = USD)
*ELSE
*REC(FACTOR=1,RPTCURRENCY = USD)
*ENDWHEN
*ENDWHEN
*ENDWHEN
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 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.