Beruflich Dokumente
Kultur Dokumente
2014
Hi, Guest
Log On
Store
Join Us
Products
About SCN
Downloads
Industries
Partnership
Developer Center
Lines of Business
University Alliances
Innovation
Activity
Communications
Actions
Brow se
Tw eet
Like
http://scn.sap.com/community/epm/blog/2013/01/02/using-javascript-to-enhance-script-logic
1/4
22.7.2014
After the refresh, the account VL004 now have the value 10, which is the square root of 100:
Extending this example, we can use other mathematical functions of java script:
*XDIM_MEMBERSET ACCOUNT = VL001
*XDIM_MEMBERSET CATEGORY = %CATEGORY_SET%
*XDIM_MEMBERSET TIME = BAS( %TIME_SET% )
*WHEN ACCOUNT
*IS VL001
*REC(EXPRESSION=javascript:Math.abs(%VALUE%), ACCOUNT="VL002")
*REC(ACCOUNT="VL005", EXPRESSION=javascript:Math.ceil(%VALUE% ) )
*REC(ACCOUNT="VL006", EXPRESSION=javascript:Math.floor(%VALUE% ) )
*REC(ACCOUNT="VL007", EXPRESSION=javascript:Math.round(%VALUE% ) )
*REC(ACCOUNT="VL008", EXPRESSION=javascript:Math.random( ) )
*ENDWHEN
http://scn.sap.com/community/epm/blog/2013/01/02/using-javascript-to-enhance-script-logic
2/4
22.7.2014
But there is a problem. If the function requires more than one parameter, the script returns a error. For example, it
is not possible to use the function Math.pow, because it requires two parameters.
This happens when engine that processes script logic breaks the *REC expression in commas, and then it breaks the
expression.
I hope it helps.
Samuel Matioli
925 View s
Share
Tw eet
Like
4 Comments
Arun Kumar Suryanarayana Rao Jan 3, 2013 7:25 AM
Hi Samuel,
Thanks for sharing the information.
Arun
http://scn.sap.com/community/epm/blog/2013/01/02/using-javascript-to-enhance-script-logic
3/4
22.7.2014
Hi Samuel,
Interesting article. As of BPC 10 SP07 the calculation engine was switched from JavaScript to ABAP
(see note 1691570). You can still still use the JavaScript engine in later versions if needed (see note
1748676)
Thanks,
John
Like (0)
Samuel Henrique Matioli Jan 4, 2013 1:18 PM (in response to John Leggio)
Thank you,
It's true.
I run my test on 7.5 SP12 and 10.0 SP06.
The SP07 has a lot of improvements in script logic engine - which in fact needs all of that
improvement.
I did not read all the notes, but BPC would can still use the javascript engine when its would
be explicitly declared, like this examples. So many customers does not need to change
their scripts.
Like (0)
Hi Samuel,
Thanks so much for the information.
Best Regards,
Karsten
Like (0)
Site Index
Privacy
Contact Us
Terms of Use
Copyright
http://scn.sap.com/community/epm/blog/2013/01/02/using-javascript-to-enhance-script-logic
Follow SCN
4/4