+ All Categories
Home > Technology > EDM Creating Formulas for Formula Profile & RTP Interface

EDM Creating Formulas for Formula Profile & RTP Interface

Date post: 30-Nov-2014
Category:
Upload: rakesh-dasgupta
View: 4,519 times
Download: 4 times
Share this document with a friend
Description:
Creating Formula for Formula Profile and RTP Interface http://wp.me/p1Ci5j-5h
7
ISU EDM: Creating formulas for use in Formula Profiles & RTP Interface This post is about creating your own formula for use in Formula profiles and RTP Interface. 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 Data Management -> Formulas. For each formula, a function module needs to defined first with the following interface, CHANGING REFERENCE (XY_CNTR) TYPE EEDMFORMULACTR REFERENCE (XY_INP) TYPE TEEDMFORMPARLIST_I REFERENCE (XY_OUT) TYPE TEEDMFORMPARLIST_O EXCEPTIONS GENERAL_FAULT. One can also use template function modules provided for this purpose. ISU_EDM_FORMULA_EASY or ISU_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 Parameters 1. Measured Consumption (kwh) 2. First Limit for Consumption (kwh) 3. Second Limit for Consumption (kwh) 4. Limit for Demand (KW)
Transcript
Page 1: EDM Creating Formulas for Formula Profile & RTP Interface

ISU EDM: Creating formulas for use in

Formula Profiles & RTP Interface

This post is about creating your own formula for use in Formula profiles and RTP

Interface.

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 Data

Management -> Formulas.

For each formula, a function module needs to defined first with the following interface,

CHANGING REFERENCE (XY_CNTR) TYPE EEDMFORMULACTR REFERENCE (XY_INP) TYPE TEEDMFORMPARLIST_I REFERENCE (XY_OUT) TYPE TEEDMFORMPARLIST_O EXCEPTIONS GENERAL_FAULT.

One can also use template function modules provided for this purpose.

ISU_EDM_FORMULA_EASY or

ISU_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 Parameters

1. Measured Consumption (kwh)

2. First Limit for Consumption (kwh)

3. Second Limit for Consumption (kwh)

4. Limit for Demand (KW)

Page 2: EDM Creating Formulas for Formula Profile & RTP Interface

Output Parameters

1. 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 Parameters

edm_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 Limit

IF 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 Demand

yval6 = xval1. edm_quant_to_demand yval6.

Page 3: EDM Creating Formulas for Formula Profile & RTP Interface

• 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 Parameters

edm_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 the

function module is mentioned and the 4 input parameters are also mentioned.

Page 4: EDM Creating Formulas for Formula Profile & RTP Interface

While allocating input parameters we also have to allocate the Calculation Mode

The calculation mode determines how a value is processed when a formula is

executed. It could, for example, enable calculation based on the status of the input

profile 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 calculation

When implementing formulas, you can use the constants

co_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

Page 5: EDM Creating Formulas for Formula Profile & RTP Interface

now I executed this formula in a formula profile.

The values of the input profiles were like this.

Page 6: EDM Creating Formulas for Formula Profile & RTP Interface

First Limit for Consumption was at 2000 kwh Second Limit for Consumption was at 5000 kwh Demand Limit was at 10000 KW.

The calculation run was executed for the formula.

Page 7: EDM Creating Formulas for Formula Profile & RTP Interface

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-5h

Do leave a feedback. :D


Recommended