{"id":402,"date":"2023-01-23T14:25:33","date_gmt":"2023-01-23T13:25:33","guid":{"rendered":"http:\/\/www.pierre-vincent.com\/memosap\/?p=402"},"modified":"2023-01-23T14:25:50","modified_gmt":"2023-01-23T13:25:50","slug":"ibp-formulas-in-kf","status":"publish","type":"post","link":"http:\/\/www.pierre-vincent.com\/memosap\/2023\/01\/23\/ibp-formulas-in-kf\/","title":{"rendered":"IBP  Formulas in KF"},"content":{"rendered":"\n<p><a href=\"https:\/\/help.sap.com\/docs\/SAP_INTEGRATED_BUSINESS_PLANNING\/bf99e931b8d44aafb4e306ec3602cbdd\/b8582c558934753ce10000000a174cb4.html?version=2105&amp;locale=en-US\">https:\/\/help.sap.com\/docs\/SAP_INTEGRATED_BUSINESS_PLANNING\/bf99e931b8d44aafb4e306ec3602cbdd\/b8582c558934753ce10000000a174cb4.html?version=2105&amp;locale=en-US<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"standard-functions\">Standard Functions<\/h2>\n\n\n\n<figure id=\"loiob8582c558934753ce10000000a174cb4__table_awb_434_3hb\" class=\"wp-block-table\"><table><thead><tr><th>Syntax<\/th><th>Details<\/th><th>Example<\/th><\/tr><\/thead><tbody><tr><td><samp>IF(intarg , arg2, arg3)<\/samp><\/td><td>Return&nbsp;<samp>arg2<\/samp>&nbsp;if&nbsp;<samp>intarg<\/samp>&nbsp;is considered true (not equal to zero), else return&nbsp;<samp>arg3<\/samp>.<\/td><td><samp>CAPACITYOVERLOADS@PERLOCRES = IF(\u201cCAPADEMANDUTILPCT@PERLOCRES\u201d&gt; 1,1,0)<\/samp><\/td><\/tr><tr><td><samp>ISNULL(arg1)<\/samp><\/td><td>Return 1 (= true), if&nbsp;<samp>arg1<\/samp>&nbsp;is set to null.<\/td><td><samp>MARKETINGFORECASTQTY@PERPRODCUST = IF(ISNULL(MARKETINGFORECASTQTY@PERPRODCUST), SALESFORECASTQTY@PERPRODCUST, MARKETINGFORECASTQTY@PERPRODCUST)<\/samp><\/td><\/tr><tr><td><samp>CASE(arg1, default)<\/samp><samp>CASE(arg1, cmp1, value1, cmp2, value2, &#8230;, default)<\/samp><\/td><td>Return&nbsp;<samp>value1<\/samp>&nbsp;if&nbsp;<samp>arg1 == cmp1<\/samp>,&nbsp;<samp>value2<\/samp>&nbsp;if&nbsp;<samp>arg1 == cmp2<\/samp>, and so on, default if there is no match.<\/td><td><samp>CASE(SELECTEDOPTION@PERPROD, 1, KF1@PERPROD, 2, KF2@PERRPROD,KF@PERPROD)<\/samp><\/td><\/tr><tr><td><samp>ABS(arg)<\/samp><\/td><td>Returns&nbsp;<samp>arg<\/samp>, if&nbsp;<samp>arg<\/samp>&nbsp;is positive or zero, else&nbsp;<samp>\u2013arg<\/samp>.<\/td><td><samp>IF(ABS(SUPPLYREV@PERPRODFML &#8211; CONSENSUSDEMANDREV@PERPRODFML)\/CONSENSUSDEMANDREV@PERPRODFML &gt; 0.2,1,0<\/samp>)<\/td><\/tr><tr><td><samp>ROUND(double, int)<\/samp><\/td><td><samp>ROUND(123.456, 0) = 123<\/samp><samp>ROUND(123.456, 1) = 123.5<\/samp><samp>ROUND(-123.456, 1) = -123.5<\/samp><samp>ROUND(123.456, -1) = 120<\/samp><\/td><td><samp>KF1@PERPRODLOCSRC = ROUND(KF@ PERPRODLOCSRC, 0)<\/samp><\/td><\/tr><tr><td><samp>ROUNDDOWN(double, int)<\/samp><\/td><td><samp>ROUNDDOWN(123.456, -1) = 120<\/samp><samp>ROUNDDOWN(-123.456, -1) = -130<\/samp><\/td><td><samp>KF1@PERPRODLOCSRC = ROUNDDOWN(KF@ PERPRODLOCSRC, 0)<\/samp><\/td><\/tr><tr><td><samp>FLOOR(double)<\/samp><\/td><td><samp>FLOOR(35.1) = 35<\/samp><\/td><td><samp>KF1@PERPRODLOC = FLOOR(KF@ PERPRODLOC)<\/samp><\/td><\/tr><tr><td><samp>CEIL(double)<\/samp><\/td><td><samp>CEIL(35.1) = 36<\/samp><\/td><td><samp>KF1@PERPRODLOC = CEIL(KF@ PERPRODLOC)<\/samp><\/td><\/tr><tr><td><samp>LTRIM(string)<\/samp><samp>LTRIM(string,string)<\/samp><\/td><td>Remove a whitespace prefix from a string. The whitespace characters may be specified in an optional argument.<\/td><td>&nbsp;<\/td><\/tr><tr><td><samp>RTRIM(string)<\/samp><samp>RTRIM(string,string)<\/samp><\/td><td>Remove trailing whitespace from a string. The whitespace characters may be specified in an optional argument.<\/td><td>&nbsp;<\/td><\/tr><tr><td><samp>TRIM(string)<\/samp><samp>TRIM(string,string)<\/samp><\/td><td>Remove whitespace from the beginning and end of a string.<\/td><td>&nbsp;<\/td><\/tr><tr><td><samp>UPPER(arg1)<\/samp><\/td><td>Returns&nbsp;<samp>arg1<\/samp>&nbsp;in upper case<\/td><td><samp>KF1@PERPRODCUST = IF(UPPER(\u00a0\u00bbATTR1\u00a0\u00bb) = \u00a0\u00bbAPPROVED\u00a0\u00bb, \u00ab\u00a0KF2@PERPRODCUST\u00a0\u00bb, NULL)<\/samp><\/td><\/tr><tr><td><samp>MIN(arg1,arg2,&#8230;)<\/samp><\/td><td>In the case of several input key figures, there is no aggregation; it returns the lowest value of the input key figures.<\/td><td><samp>MINCAPACITY@MTHPRODLOC = MIN(\u00ab\u00a0CAPACITYMORNING@MTHPRODLOC\u00a0\u00bb, \u00ab\u00a0CAPACITYAFTERNOON@MTHPRODLOC\u00a0\u00bb, \u00ab\u00a0CAPACITYNIGHT@MTHPRODLOC\u00a0\u00bb)<\/samp><\/td><\/tr><tr><td><samp>MAX(arg1,arg2,&#8230;)<\/samp><\/td><td>In the case of several input key figures, there is no aggregation; it returns the highest value of the input key figures.<\/td><td><samp>MAXCAPACITY@MTHPRODLOC = MAX(\u00ab\u00a0CAPACITYMORNING@MTHPRODLOC\u00a0\u00bb, \u00ab\u00a0CAPACITYAFTERNOON@MTHPRODLOC\u00a0\u00bb, \u00ab\u00a0CAPACITYNIGHT@MTHPRODLOC\u00a0\u00bb)<\/samp><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Example<\/strong><\/p>\n\n\n\n<p>Sample configuration for aggregation of standard deviation<\/p>\n\n\n\n<p>Take the sum of the squares; then calculate the square root of the total:<\/p>\n\n\n\n<ol class=\"wp-block-list\" id=\"loiob8582c558934753ce10000000a174cb4__ol_ssx_p34_3hb\">\n<li>Calculate the squares:\n<ol class=\"wp-block-list\" type=\"a\">\n<li>Square the values:<samp>HKF1@PL = PROPAGATEDDEMANDSTDEV@PL ** 2<\/samp><\/li>\n\n\n\n<li>Sum the squares:<samp>HKF1@REQUEST = SUM(HKF1@PL)<\/samp><\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Calculate the square root of the total:<samp>PROPAGATEDDEMANDSTDEV@REQUEST= HKF1@REQUEST ** 0.5<\/samp><\/li>\n<\/ol>\n\n\n\n<p><strong>Example<\/strong><\/p>\n\n\n\n<p>ISNULL<\/p>\n\n\n\n<p>The&nbsp;ISNULL&nbsp;condition works only when an underlying time series record exists for the planning object.<\/p>\n\n\n\n<p>Imagine that&nbsp;<strong>Sales Forecast Quantity<\/strong>&nbsp;and&nbsp;<strong>Marketing Forecast Quantity<\/strong>&nbsp;are the stored key figures for planning level&nbsp;PERPROD.<\/p>\n\n\n\n<figure id=\"loiob8582c558934753ce10000000a174cb4__table_apx_x34_3hb\" class=\"wp-block-table\"><table><thead><tr><th>Planning Object<\/th><th>Period<\/th><th>Key Figure: Sales Forecast Qty<\/th><th>Key Figure: Marketing Forecast Qty<\/th><\/tr><\/thead><tbody><tr><td>P1<\/td><td>Jan 2018<\/td><td>100<\/td><td>&nbsp;<\/td><\/tr><tr><td>P1<\/td><td>Mar 2018<\/td><td>&nbsp;<\/td><td>100<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>With the above data,&nbsp;<samp>IF(ISNULL(SALESFCSTQTY),1,0)<\/samp>&nbsp;exhibits the following behavior:<\/p>\n\n\n\n<figure id=\"loiob8582c558934753ce10000000a174cb4__table_bjq_y34_3hb\" class=\"wp-block-table\"><table><thead><tr><th>Period<\/th><th>ISNULL Value<\/th><th>Notes<\/th><\/tr><\/thead><tbody><tr><td>Jan 2018<\/td><td>0<\/td><td>January 2018 has the value&nbsp;\u201c100\u201d.<\/td><\/tr><tr><td>Feb 2018<\/td><td>Not evaluated<\/td><td>The planning object for the time period February 2018 does not exist.<\/td><\/tr><tr><td>Mar 2018<\/td><td>1<\/td><td>Though there is no value for&nbsp;<strong>Sales Forecast Quantity<\/strong>, the&nbsp;<strong>Marketing Forecast Quantity<\/strong>&nbsp;key figure (for the same planning level) has a valid value. Therefore, a record exists in the time series for this planning object.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"sample-expressions\">Sample Expressions<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Key Figure<\/th><th>Calculation Expression<\/th><\/tr><\/thead><tbody><tr><td><strong>Actuals Price<\/strong><\/td><td><samp>ACTUALSPRICE@REQUEST = IF(\u201cACTUALSQTY@REQUEST\u201d=0,0,&nbsp;\u201cACTUALSREV@REQUEST\u201d\/\u201cACTUALSQTY@REQUEST\u201d)<\/samp><\/td><\/tr><tr><td><strong>Capacity Overloads<\/strong><\/td><td><samp>CAPACITYOVERLOADS@PERLOCRES = IF(\u201cCAPADEMANDUTILPCT@PERLOCRES\u201d&gt; 1,1,0)<\/samp><\/td><\/tr><tr><td><strong>Capacity Usage<\/strong><\/td><td><samp>CAPAUSAGE@PERPRODLOCRES =&nbsp;\u201cCAPADEMAND@PERPRODLOCRES\u201d*\u201c(IF(CAPASUPPLYPERDEMAND@PERLOCRES\u201d&gt;1,1,&nbsp;\u201cCAPASUPPLYPERDEMAND@PERLOCRES\u201d))<\/samp><\/td><\/tr><tr><td><strong>Marketing Forecast Profit<\/strong><\/td><td><samp>MARKETINGFORECASTPROFIT@PERPRODCUST =&nbsp;\u201cMARKETINGFORECASTREV@PERPRODCUST\u201d-&nbsp;\u201cHMARKETINGFORECASTCOST@PERPRODCUST\u201d<\/samp><\/td><\/tr><tr><td><strong>Marketing Forecast Quantity<\/strong><\/td><td><samp>MARKETINGFORECASTQTY@PERPRODCUST = IF(ISNULL(\u00ab\u00a0MARKETINGFORECASTQTY@PERPRODCUST\u00a0\u00bb), \u00ab\u00a0SALESFORECASTQTY@PERPRODCUST\u00a0\u00bb, \u00ab\u00a0MARKETINGFORECASTQTY@PERPRODCUST\u00a0\u00bb)<\/samp><\/td><\/tr><tr><td><strong>Constrained Versus Consensus Demand Revenue<\/strong><\/td><td><samp>CONSTRAINEDVSCONSENSUSREV@PERPRODFML = IF(ISNULL(\u00ab\u00a0CONSENSUSDEMANDREV@PERPRODFML\u00a0\u00bb)OR \u00ab\u00a0CONSENSUSDEMANDREV@PERPRODFML\u00a0\u00bb=0,0, IF(ABS(\u00ab\u00a0SUPPLYREV@PERPRODFML\u00a0\u00bb &#8211; \u00ab\u00a0CONSENSUSDEMANDREV@PERPRODFML\u00a0\u00bb)\/\u00a0\u00bbCONSENSUSDEMANDREV@PERPRODFML\u00a0\u00bb &gt; 0,2,1,0))<\/samp><\/td><\/tr><tr><td><strong>Supply Quantity<\/strong><\/td><td><samp>SUPPLYQTY@PERPRODLOC = IF(\u00ab\u00a0HPROJECTEDINVENTORYQTY@PERPRODLOC\u00a0\u00bb&gt;=0, \u00ab\u00a0DEPENDENTDEMANDQTY@PERPRODLOC\u00a0\u00bb, \u00ab\u00a0DEPENDENTDEMANDQTY@PERPRODLOC\u00a0\u00bb+ \u00ab\u00a0HPROJECTEDINVENTORYQTY@PERPRODLOC\u00a0\u00bb)<\/samp><\/td><\/tr><tr><td><strong>Bill Cost per Area Demand Revenue<\/strong><\/td><td><samp>BILL_COST_PER_AREA@BSCIRTRSCFRCTOUFRUTO2L3AVG_A = IF(isnull(\u00ab\u00a0ASSETAREA5@BSCIRTRSCFRCTOUFRUTO2L3AVG_A\u00a0\u00bb) or \u00ab\u00a0ASSETAREA5@BSCIRTRSCFRCTOUFRUTO2L3AVG_A\u00a0\u00bb=0,0,\u00a0\u00bbBILL_COST5@BSCIRTRSCFRCTOUFRUTO2L3AVG_A\u00a0\u00bb\/\u00a0\u00bbASSETAREA5@BSCIRT<\/samp><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/help.sap.com\/docs\/SAP_INTEGRATED_BUSINESS_PLANNING\/bf99e931b8d44aafb4e306ec3602cbdd\/b8582c558934753ce10000000a174cb4.html?version=2105&amp;locale=en-US Standard Functions Syntax Details Example IF(intarg , arg2, arg3) Return&nbsp;arg2&nbsp;if&nbsp;intarg&nbsp;is considered true (not equal to zero), else return&nbsp;arg3. CAPACITYOVERLOADS@PERLOCRES = IF(\u201cCAPADEMANDUTILPCT@PERLOCRES\u201d&gt; 1,1,0) ISNULL(arg1) Return 1 (= true), if&nbsp;arg1&nbsp;is set to null. MARKETINGFORECASTQTY@PERPRODCUST = IF(ISNULL(MARKETINGFORECASTQTY@PERPRODCUST), SALESFORECASTQTY@PERPRODCUST, MARKETINGFORECASTQTY@PERPRODCUST) CASE(arg1, default)CASE(arg1, cmp1, &hellip; <a href=\"http:\/\/www.pierre-vincent.com\/memosap\/2023\/01\/23\/ibp-formulas-in-kf\/\">Continuer la lecture <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":[7],"tags":[],"class_list":["post-402","post","type-post","status-publish","format-standard","hentry","category-ibp"],"_links":{"self":[{"href":"http:\/\/www.pierre-vincent.com\/memosap\/wp-json\/wp\/v2\/posts\/402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.pierre-vincent.com\/memosap\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.pierre-vincent.com\/memosap\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.pierre-vincent.com\/memosap\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.pierre-vincent.com\/memosap\/wp-json\/wp\/v2\/comments?post=402"}],"version-history":[{"count":1,"href":"http:\/\/www.pierre-vincent.com\/memosap\/wp-json\/wp\/v2\/posts\/402\/revisions"}],"predecessor-version":[{"id":404,"href":"http:\/\/www.pierre-vincent.com\/memosap\/wp-json\/wp\/v2\/posts\/402\/revisions\/404"}],"wp:attachment":[{"href":"http:\/\/www.pierre-vincent.com\/memosap\/wp-json\/wp\/v2\/media?parent=402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.pierre-vincent.com\/memosap\/wp-json\/wp\/v2\/categories?post=402"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.pierre-vincent.com\/memosap\/wp-json\/wp\/v2\/tags?post=402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}