After spending some time answering questions about script issues I've found the following:
In more than 60% of cases in order to give a useful answer I have to ask many additional questions to understand the issue!
I decided to summarize some generic rules to speed up the process:
1. Always provide BPC version and SP level of core BPC system (scripts work differently in 7.5 and 10 and even with different SP level).
2. For BPC NW 10 provide the K2 calculation engine used: ABAP or JAVASCRIPT (also difference in script execution).
3. Please describe models/applications: full list of dimensions and some members examples relevant to the script discussed. For Accunt dimension members provide ACCTYPE priperty.
4. Clearly identify the purpose of the script: to run as default.lgf or to be launched by DM package (different calculation logic!).
5. Describe the calculation logic using some pseudo formulas like: Amount=Price*Quantity etc. Add some description in words about calculation logic.
6. Provide FULL script that is not working (showing only part of the script without some previous scope changes can lead to misunderstanding).
7. The best option is to provide script tests in UJKT, including original script, Data Region content, PARAM content and log result with generated LGX.
8. Show report data before and after script run if the script is working, but generating incorrect results. Report data have to contain member names for better understanding.
9. If there are questions about advanced DM scripts - full text of the script have to be provided. Add also list of dimensions and text of script logic script.
Example:
-----------------------------------------------------------------------------------------------------------------
Topic name: Script write multiple of correct value
BPC NW 10 SP 11, Engine ABAP.
In the model SOMEMODEL we have the following dimensions: ACCOUNT (A), TIME (T), CATEGORY (C), ENTITY (E), CURRENCY (R), PRODUCT (User Def)
In the ACCOUNT dimension there are members PRICE (EXP),QUANTITY (EXP), DISCOUNT (EXP) and AMOUNT (EXP)
We want to calculate in default.lgf AMOUNT=QUANTITY*PRICE*(1-DISCOUNT). When user enter or change any or all members PRICE, QUANTITY and DISCOUNT in the input schedule and save data the AMOUNT have to be calculated.
The script:
*WHEN ACCOUNT
*IS PRICE
*REC(EXPRESSION=[ACCOUNT].[QUANTITY]*%VALUE%*(1-[ACCOUNT].[DISCOUNT]), ACCOUNT= "AMOUNT")
*IS QUANTITY
*REC(EXPRESSION=%VALUE%*[ACCOUNT].[PRICE]*(1-[ACCOUNT].[DISCOUNT]), ACCOUNT= "AMOUNT")
*IS DISCOUNT
*REC(EXPRESSION=[ACCOUNT].[QUANTITY]*[ACCOUNT].[PRICE]*(1-%VALUE%), ACCOUNT= "AMOUNT")
*ENDWHEN
In UJKT we test this script with Data Region:
TIME=2013.09
CATEGORY=Actual
ENTITY=US
CURRENCY=LC
PRODUCT=Prod1
The values for ACCOUNTs in the report are:
PRICE: 100
DISCOUNT: 0.5
QUANTITY: 4
Expected result: 200=100*4*(1-0.5)
Result in UJKT:
LGX:
*WHEN ACCOUNT
*IS PRICE
*REC(EXPRESSION=[ACCOUNT].[QUANTITY]*%VALUE%*(1-[ACCOUNT].[DISCOUNT]), ACCOUNT= AMOUNT)
*IS QUANTITY
*REC(EXPRESSION=%VALUE%*[ACCOUNT].[PRICE]*(1-[ACCOUNT].[DISCOUNT]), ACCOUNT= AMOUNT)
*IS DISCOUNT
*REC(EXPRESSION=[ACCOUNT].[QUANTITY]*[ACCOUNT].[PRICE]*(1-%VALUE%), ACCOUNT= AMOUNT)
*ENDWHEN
-------------------------------------------------------------------------------------------------------------------------------------
LOG:
LOG ENTITYGIN TIME:2014-01-31 16:18:24
FILE:\ROOT\WEBFOLDERS\SOMEENV \ADMINAPP\SOMEMODEL\TEST.LGF
USER:V.KALININ
APPSET:SOMEENV
APPLICATION:SOMEMODEL
[INFO] GET_DIM_LIST(): I_APPL_ID="SOMEMODEL", #dimensions=7
ACCOUNT,ENTITY,MEASURES,TIME,CATEGORY,CURRENCY,PRODUCT
#dim_memberrset=4
TIME:2013.09,1 in total.
CATEGORY:Actual,1 in total.
PRODUCT:Prod1,1 in total.
ENTITY:US,1 in total.
CURRENCY:LC,1 in total.
REC :[ACCOUNT].[QUANTITY]*%VALUE%*(1-[ACCOUNT].[DISCOUNT])
CALCULATION ENTITYGIN:
QUERY PROCESSING DATA
QUERY TIME : 0.00 ms. 1 RECORDS QUERIED OUT.
QUERY REFERENCE DATA
QUERY TIME : 1.00 ms. 3 RECORDS QUERIED OUT.
CALCULATION TIME IN TOTAL :0.00 ms.
1 RECORDS ARE GENERATED.
CALCULATION END.
#dim_memberrset=4
TIME:2013.09,1 in total.
CATEGORY:Actual,1 in total.
PRODUCT:Prod1,1 in total.
ENTITY:US,1 in total.
CURRENCY:LC,1 in total.
REC :%VALUE%*[ACCOUNT].[PRICE]*(1-[ACCOUNT].[DISCOUNT])
CALCULATION ENTITYGIN:
QUERY PROCESSING DATA
QUERY TIME : 0.00 ms. 1 RECORDS QUERIED OUT.
QUERY REFERENCE DATA
QUERY TIME : 0.00 ms. 3 RECORDS QUERIED OUT.
CALCULATION TIME IN TOTAL :0.00 ms.
1 RECORDS ARE GENERATED.
CALCULATION END.
#dim_memberrset=4
TIME:2013.09,1 in total.
CATEGORY:Actual,1 in total.
PRODUCT:Prod1,1 in total.
ENTITY:US,1 in total.
CURRENCY:LC,1 in total.
REC :[ACCOUNT].[QUANTITY]*[ACCOUNT].[PRICE]*(1-%VALUE%)
CALCULATION ENTITYGIN:
QUERY PROCESSING DATA
QUERY TIME : 1.00 ms. 1 RECORDS QUERIED OUT.
QUERY REFERENCE DATA
QUERY TIME : 0.00 ms. 3 RECORDS QUERIED OUT.
CALCULATION TIME IN TOTAL :0.00 ms.
1 RECORDS ARE GENERATED.
CALCULATION END.
ENDWHEN ACCUMULATION: 1 RECORDS ARE GENERATED.
DATA TO WRITE BACK:
ACCOUNT ENTITY TIME CATEGORY PRODUCT SIGNEDDATA
AMOUNT US 2013.09 Actual Prod1 600.00
1 RECORDS HAVE BEEN WRITTEN BACK.
WRITING TIME :6.00 ms.
SCRIPT RUNNING TIME IN TOTAL:8.00 s.
LOG END TIME:2014-01-31 16:18:32
And the report for:
ACCOUNT=AMOUNT
TIME=2013.09
CATEGORY=Actual
ENTITY=US
CURRENCY=LC
PRODUCT=Prod1
Shows the value for AMOUNT: 600 - 3 times more than expected.
What is the reason?
-----------------------------------------------------------------------------------------------------------------
Sample End
Best Regards,
Vadim