{"id":73,"date":"2011-04-18T20:35:00","date_gmt":"2011-04-18T20:35:00","guid":{"rendered":"http:\/\/www.sapbpc.sapag.co.in\/?p=73"},"modified":"2011-04-18T20:35:00","modified_gmt":"2011-04-18T20:35:00","slug":"why-the-new-script-logic-keyword-when_ref_data","status":"publish","type":"post","link":"https:\/\/www.sapbpc.sapag.co.in\/?p=73","title":{"rendered":"Why the new script logic keyword &#8211; *WHEN_REF_DATA?"},"content":{"rendered":"<p>At times in SAP Business Planning and Consolidation, when writing a *WHEN-*REC-*ENDWHEN structure in script logic, we may come across a scenario where we want to post value to an intersection\/region where there is no data. This was not supported previously as calculations happen in transaction mode by default.<\/p>\n<p>The above is not a limitation anymore in SAP BPC NW with the new script logic keyword -*WHEN_REF_DATA. This allows us to switch our calculation mode to either transaction data or master data.&#160; <\/p>\n<p><strong>Syntax<\/strong><\/p>\n<p><strong>1)&#160;&#160;&#160;&#160;&#160; <\/strong><strong>To enable master data mode<\/strong><\/p>\n<p>*WHEN_REF_DATA = MASTER_DATA&#160;&#160;&#160;&#160; <\/p>\n<p>\/\/*WHEN-*REC-*ENDWHEN CONSTRUCT<\/p>\n<p><strong>2)&#160;&#160;&#160;&#160;&#160; <\/strong><strong>To enable transaction data mode<\/strong><\/p>\n<p>*WHEN_REF_DATA = TRANS_DATA&#160;&#160;&#160;&#160; <\/p>\n<p>\/\/*WHEN-*REC-*ENDWHEN CONSTRUCT<\/p>\n<ul>\n<li>In transaction data mode, calculations will happen based on the transaction data in the source data region <\/li>\n<li>In master data mode, calculations will happen based on the Cartesian product of the source data region no matter if the transaction data exists or not <\/li>\n<li>The mode is set to transaction by default. So when we do not use this keyword in our logic, all the calculations in *WHEN construct will happen in transaction mode <\/li>\n<li>When we use the *WHEN_REF_DATA statement, all the calculations in following *WHEN&#160; constructs will happen in the mode specified until the next *WHEN_REF_DAT (if specified) <\/li>\n<\/ul>\n<p><strong>Example<\/strong><\/p>\n<p>*XDIM_MEMBERSET TIME=2010.MAR<\/p>\n<p>*WHEN ACCOUNT<\/p>\n<p>*IS&#160; ACC1<\/p>\n<p>*REC(EXPRESSION=1000, ACCOUNT=ACC2)<\/p>\n<p>*ENDWHEN<\/p>\n<p>Here we have no *WHEN_REF_DATA and thus calculations will happen in the default mode i.e. transaction data mode. A value of 1000 will be written to ACC2 wherever there is a value for ACC1 in the period 2010.MAR.<\/p>\n<p>Now, let us look at the same example in master data mode.<\/p>\n<p>*XDIM_MEMBERSET TIME=2010.MAR<\/p>\n<p>*WHEN_REF_DATA = MASTER_DATA&#160;&#160;&#160; <\/p>\n<p>*WHEN ACCOUNT<\/p>\n<p>*IS&#160; ACC1<\/p>\n<p>*REC(EXPRESSION=1000, ACCOUNT=ACC2)<\/p>\n<p>*ENDWHEN<\/p>\n<p>In this case, 1000 will be written to ACC2 even when there is no data for ACC1 in the period 2010.MAR.<\/p>\n<p>Please check the <a href=\"https:\/\/websmp230.sap-ag.de\/sap(bD1lbiZjPTAwMQ==)\/bc\/bsp\/spn\/sapnotes\/index2.htm?numm=1474115\">Note 1474115<\/a> for further details.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>At times in SAP Business Planning and Consolidation, when writing a *WHEN-*REC-*ENDWHEN structure in script logic, we may come across a scenario where we want to post value to an intersection\/region where there is no data. This was not supported &hellip; <a href=\"https:\/\/www.sapbpc.sapag.co.in\/?p=73\">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":[3],"tags":[],"class_list":["post-73","post","type-post","status-publish","format-standard","hentry","category-sap-bpc-tutorials"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.sapbpc.sapag.co.in\/index.php?rest_route=\/wp\/v2\/posts\/73","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=73"}],"version-history":[{"count":0,"href":"https:\/\/www.sapbpc.sapag.co.in\/index.php?rest_route=\/wp\/v2\/posts\/73\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sapbpc.sapag.co.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sapbpc.sapag.co.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sapbpc.sapag.co.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}