{"id":18,"date":"2010-07-20T17:14:00","date_gmt":"2010-07-20T17:14:00","guid":{"rendered":"http:\/\/www.sapbpc.sapag.co.in\/?p=18"},"modified":"2010-07-20T17:14:00","modified_gmt":"2010-07-20T17:14:00","slug":"using-javascript-in-sap-businessobjects-planning-and-consolidation-version-for-netweaver","status":"publish","type":"post","link":"https:\/\/www.sapbpc.sapag.co.in\/?p=18","title":{"rendered":"Using JavaScript in SAP BusinessObjects Planning and Consolidation, version for Netweaver"},"content":{"rendered":"<p align=\"justify\">General Syntax:<br \/>The data to be converted is initially identified in the system variable %external%. JavaScript functionality can be accessed by preceding any command with the key &#8220;js:&#8221; to indicate a JavaScript command will follow next. <\/p>\n<p align=\"justify\">To use JavaScript, ensure that the CONVERT_INTERNAL parameter is set in the calling Transformation file as follows:<br \/>If the transformation option Convert_Internal = NO, JavaScript can be used in the Internal column.<br \/>Example: the function js:parseInt(%internal%) placed in the internal column of the conversion sheet will return the Integer portion of the converted data. <\/p>\n<p align=\"justify\">If the transformation option Convert_Internal = YES, JavaScript can be used in the External column.<br \/>Example: the function js:parseInt(%external%) placed in the external column of the conversion sheet will return the Integer portion of the incoming data. <\/p>\n<p align=\"justify\">JavaScript can also be used in the FORMULA column of the Conversion sheet. The system variable &#8220;Value&#8221; is defined as the initial value of the string before processing:<br \/>js:Math.round(Value) and Value =0.60 returns the quantity &#8220;1&#8221; <br \/>js:Math.round(Value) and Value =0.50 returns the quantity &#8220;1&#8221;<br \/>js:Math.round(Value) and Value =0.49 returns the quantity &#8220;0&#8221;<br \/>js:Math.round(Value) and Value =-4.43 returns the quantity &#8220;-4&#8221;<\/p>\n<p align=\"justify\">Example: <\/p>\n<p align=\"justify\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" alt=\"\" align=\"middle\" src=\"https:\/\/weblogs.sdn.sap.com\/weblogs\/images\/251702118\/BPC_JavaScript1_640x130.jpg\" width=\"640\" height=\"130\"><\/p>\n<p align=\"justify\">Wildcards<br \/>You can use the asterisk (*) and question mark (?) wildcards in the External or Internal columns.<br \/>An asterisk (*) stands for any character, while a question mark (?) stands for any single<br \/>character. For example, if you want to reference all members, use the asterisk (*). Example: <\/p>\n<p align=\"justify\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" alt=\"\" align=\"middle\" src=\"https:\/\/weblogs.sdn.sap.com\/weblogs\/images\/251702118\/BPC_JavaScript2_640_61.jpg\" width=\"640\" height=\"61\"><\/p>\n<p align=\"justify\">JavaScript function: <strong>parseInt()<br \/><\/strong>This function parses an input string and returns an integer value. For example:<br \/>js:parseInt(%external%)and %external%=&#8221;10 &#8221; returns the value 10<br \/>js:parseInt(%external%)and %external%=&#8221;10.00&#8243; returns the value 10 <br \/>js:parseInt(%external%)and %external%=&#8221;50.33&#8243; returns the value 50<br \/>js:parseInt(%external%)and %external%=&#8221;000000010&#8243; returns the value 10<br \/>js:parseInt(%external%)and %external%=&#8221;C000010&#8243; returns the value &#8220;NaN&#8221;<\/p>\n<p align=\"justify\">Tips and Notes:<br \/>1. Only the first number in the string is returned!<br \/>2. Leading and trailing spaces are allowed.<br \/>3. If the first character cannot be converted to a number, parseInt() returns NaN (&#8220;Not a Number&#8221;). <\/p>\n<p align=\"justify\">Example:  <\/p>\n<p align=\"justify\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" alt=\"\" align=\"middle\" src=\"https:\/\/weblogs.sdn.sap.com\/weblogs\/images\/251702118\/BPC_JavaScript3_640x93.jpg\" width=\"640\" height=\"93\"><\/p>\n<p align=\"justify\">JavaScript function: if&#8230;then&#8230;else<br \/>Use the if\/then\/else statement to execute some code if the condition is true and another code if the condition is false. <br \/>See example above: js: if(isNaN(%external%)) then %external%.substring(0,6);else parseInt(%external%) . <\/p>\n<p align=\"justify\">JavaScript function: toUpperCase()<br \/>This function coverts all characters in the input string into upper case characters.<br \/>Example:<\/p>\n<p align=\"justify\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" alt=\"\" src=\"https:\/\/weblogs.sdn.sap.com\/weblogs\/images\/251702118\/BPC_JavaScript4_640x70.jpg\" width=\"640\" height=\"70\"><\/p>\n<p align=\"justify\">JavaScript function: replace <br \/>This function finds a match between a substring (or regular expression) and a string, and replaces the matched substring with a new substring.<br \/>Example:<\/p>\n<p align=\"justify\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" alt=\"\" align=\"middle\" src=\"https:\/\/weblogs.sdn.sap.com\/weblogs\/images\/251702118\/BPC_JavaScript5_640x133.jpg\" width=\"640\" height=\"133\"><\/p>\n<p align=\"justify\">JavaScript function: split &amp; join <br \/>This function finds a match between a substring (or regular expression) and a string, and replaces the matched substring with a new substring. <\/p>\n<p align=\"justify\">Example: <\/p>\n<p align=\"justify\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" alt=\"\" align=\"middle\" src=\"https:\/\/weblogs.sdn.sap.com\/weblogs\/images\/251702118\/BPC_JavaScript6_640x61.jpg\" width=\"640\" height=\"61\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>General Syntax:The data to be converted is initially identified in the system variable %external%. JavaScript functionality can be accessed by preceding any command with the key &#8220;js:&#8221; to indicate a JavaScript command will follow next. To use JavaScript, ensure that &hellip; <a href=\"https:\/\/www.sapbpc.sapag.co.in\/?p=18\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-18","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.sapbpc.sapag.co.in\/index.php?rest_route=\/wp\/v2\/posts\/18","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sapbpc.sapag.co.in\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sapbpc.sapag.co.in\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sapbpc.sapag.co.in\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sapbpc.sapag.co.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=18"}],"version-history":[{"count":0,"href":"https:\/\/www.sapbpc.sapag.co.in\/index.php?rest_route=\/wp\/v2\/posts\/18\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sapbpc.sapag.co.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=18"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sapbpc.sapag.co.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=18"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sapbpc.sapag.co.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=18"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}