EDM Creating Formulas for Formula Profile & RTP Interface


Published on

Creating Formula for Formula Profile and RTP Interface

Published in: Technology, Business
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

EDM Creating Formulas for Formula Profile & RTP Interface

  1. 1. ISU EDM: Creating formulas for use inFormula Profiles & RTP InterfaceThis post is about creating your own formula for use in Formula profiles and RTPInterface.Formulas are predefined by SAP.But one can define formulas with specific functions in Customizing for SAP Utilities,Tools -> System Modifications -> User Defined Enhancement for Energy DataManagement -> Formulas.For each formula, a function module needs to defined first with the following interface,CHANGINGREFERENCE (XY_CNTR) TYPE EEDMFORMULACTRREFERENCE (XY_INP) TYPE TEEDMFORMPARLIST_IREFERENCE (XY_OUT) TYPE TEEDMFORMPARLIST_OEXCEPTIONSGENERAL_FAULT.One can also use template function modules provided for this purpose.ISU_EDM_FORMULA_EASY orISU_EDM_FORMULA_XXXX.I intend to create a formula similar to LIMIT04 but with some difference.My formula has 4 input parameters and 6 Output Parameters.Input Parameters1. Measured Consumption (kwh)2. First Limit for Consumption (kwh)3. Second Limit for Consumption (kwh)4. Limit for Demand (KW)
  2. 2. Output Parameters1. Portion below First Limit (kwh)2. Portion above First Limit (kwh)3. Portion above second Limit (kwh)4. Net Demand (Just for Evaluation)(KW)5. Demand below Limit (KW)6. Demand above Limit (KW)So first I created a function module by copying the template function module.Here I give snippets of the code • The 4 Input Parametersedm_read_input 1.edm_read_input 2.edm_read_input 3.edm_read_input 4. • Check if Measured Consumption exceeds First Limit and then if Measured Consumption exceeds Second LimitIF xval1 > xval2. yval1 = xval2. yval2 = xval1 - xval2.ELSE. yval1 = xval1. yval2 = 0.ENDIF.IF xval1 > xval3. yval3 = xval1 - xval3.ELSE. yval3 = 0.ENDIF. • Converting Measured Consumption into Net Demandyval6 = xval1.edm_quant_to_demand yval6.
  3. 3. • Calculating Below and Above Limit for Demand if yval6 > xval4. yval4 = xval4. else. yval4 = yval6. endif. if yval6 > xval4. yval5 = yval6 - xval4. else. yval5 = 0. endif. • Appending the result to the Output Parametersedm_append_output 1.edm_append_output 2.edm_append_output 3.edm_append_output 4.edm_append_output 5.edm_append_output 6.This is how the RTP Formula : Input Parameters Looks like. As you can see thefunction module is mentioned and the 4 input parameters are also mentioned.
  4. 4. While allocating input parameters we also have to allocate the Calculation ModeThe calculation mode determines how a value is processed when a formula isexecuted. It could, for example, enable calculation based on the status of the inputprofile value.SAP has already predefined a number of calculation modes:•01 – Value included in calculation•02 – Value not included in calculation•99 – Value results in cancellation of calculationWhen implementing formulas, you can use the constantsco_calcmod_use type e_formulamod value 01,co_calcmod_not_use type e_formulamod value 02,co_calcmod_abort type e_formulamod value 99.Below are the Output Parameters
  5. 5. now I executed this formula in a formula profile.The values of the input profiles were like this.
  6. 6. First Limit for Consumption was at 2000 kwhSecond Limit for Consumption was at 5000 kwhDemand Limit was at 10000 KW.The calculation run was executed for the formula.
  7. 7. The profile values generated were.So you see that not much coding is necessary once the logic is clear :)This is also available in my blog at http://wp.me/p1Ci5j-5hDo leave a feedback. :D