Financial Management Blogs by Members
Dive into a treasure trove of SAP financial management wisdom shared by a vibrant community of bloggers. Submit a blog post of your own to share knowledge.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member186338
Active Contributor
16,170

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.X and even with different SP level). SP of BW component is also required. This info is located in SAP GUI: Menu -> System -> Status...: SAP Data - Sap System Data - Product Version - Button Component information:



or for BW 750+ - only BW version:



2. For BPC NW 10 provide the K2 calculation engine used: ABAP or JAVASCRIPT (also difference in script execution). To test engine you can validate simple script in UJKT:
*WHEN ACCOUNT // or any dimension
*IS *
*REC(EXPRESSION=Math.round(%VALUE%))
*ENDWHEN

If current engine is ABAP you will get error: "UJK_VALIDATION_EXCEPTION:Field "MATH" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. "DATA" statement."

3. Please describe models/applications: full list of dimensions and some members examples relevant to the script discussed. For Account dimension members provide ACCTYPE property.

4. Clearly identify the purpose of the script: to run as default.lgf or to be launched by DM package (different calculation logic!). Please, ALWAYS answer this question!!!! If you want to write default.lgf script, please read: How-To: Write default.lgf

5. Describe the calculation logic using some pseudo formulas like: Amount=Price*Quantity etc. Add some description in words about calculation logic. Explain the business logic behind this script. In most cases it's better to show sample data before script run and after.

6. Provide FULL script that is not working (showing only part of the script without some previous scope changes can lead to misunderstanding). It's better to use "CODE" button to format the code text. Don't use screenshot of the script!

7. For DM scripts define what user will select/enter for DM prompts. For default.lgf - explain the data sent by user in the input schedule.

8. The best option is to provide script tests in UJKT, including original script, Data Region content, PARAM content and log result with generated LGX. The information about UJKT usage can be found here: Testing Logic Script UJKT

9. 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. Don't show the cube records in RSA1 - hard to analyze. In the most cases it's better to show the report screenshot (inline, not as a separate attachment). At least using Firefox browser it's easy to simply paste any picture in the message edit window (not working currently with latest versions of FireFox).

10. If there are questions about advanced DM scripts - full text of the advanced script have to be provided. Add also list of dimensions and text of script logic script.

Example:




Question name: Script write multiple of correct value

BPC NW 10 SP 14, BW 730 SP 12, 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 ACCOUNT members in the report are:



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 result in report:



Shows the value for AMOUNT: 600 - 3 times more than expected.

What is the reason?




Example End

Best Regards,
Vadim

Updated on 2015.07.23, 2016.12.09, 2018.11.26

15 Comments
Labels in this area