on ‎2016 Feb 02 1:41 AM
Hello Everyone,
Ran across a piece of script logic I have never seen before:
*WHEN RPTCURRENCY
*IS USD
*WHEN ACCOUNT
*IS ACCOUNT1
*REC(EXPRESSION = %VALUE% * -1 * (([ACCOUNT].[ACCOUNT2],[RPTCURRENCY].[LC])>-1) * (([ACCOUNT].[ACCOUNT2],[RPTCURRENCY].[LC])<1),ACCOUNT="ACCOUNT3")
*ENDWHEN
*ENDWHEN
Upon execution, the behavior of the *REC statement appears to be as follows:
If the value of ACCOUNT2 is greater than -1 and less than 1 (or said another way...if the value of ACCOUNT2 is between -1 and 1)
, then multiply the value of ACCOUNT1 by -1, and write result to ACCOUNT3.
Can anyone confirm this is in fact the correct behavior of the logic?
Best regards,
-Matt
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
P.S. Yes, just tested - will work only in case of JavaScript calculation engine.
P.P.S. Using the note http://service.sap.com/sap/support/notes/2228643
you can use multiple conditions in ternary operator with ABAP engine!
SP:
800 | |
801 | |
810 |
Thank you for the feedback, Vadim! Very interesting.
Per your blog post, I tested the script logic code you provided to determine whether the K2 calculation engine is ABAP or Javascript:
*WHEN ACCOUNT
*IS *
*REC(EXPRESSION=Math.round(%VALUE%))
*ENDWHEN
It does validate in UJKT, so K2 calculation engine is Javascript.
FYI...BPC Version and SP Level:
Reviewed the following SAP Notes:
2010964 - BPC parameters list and how they impact system behavior - BPC NW 10.0/10.1
1691570 - K2: Replace Javascript with ABAP calculation engine
K2_CALC_ENGINE global parameter not specified. Assuming that means the default is JavaScript?
Looked at the pros and cons listed in 1691570. Since I'm still getting familiar with the implemented solution, will need to review all script logic to determine the magnitude of what would have to be re-written if we were to switch the K2 calculation engine to ABAP.
Thanks again, Vadim. This was very helpful.
Best regards,
-Matt
"K2_CALC_ENGINE global parameter not specified. Assuming that means the default is JavaScript?" - Yes!
In general ABAP engine is significantly faster, but a lot of scripts can be incompatible! You have to test. String in SPRO for ABAP is ABAP, for JavaScript is JS. If you switch to ABAP all scripts will be validated and in case of error - JS will remain.
For AND condition in ternary operator you will need SP 20
Vadim
| User | Count |
|---|---|
| 41 | |
| 4 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.