Example: Creating FunctionsStarting Situation
You want to create a template in such a way that a business process "Quality Inspection" is only activated when the confirmed quantities of an order deviates from the total order quantity. In order to do this you need a function that allows you to access the confirmed order quantities. You create this is in the following way: (a function for the total order quantity already exists).
Note
The function Order_Yield_Confirmed already exists in the standard SAP System. This gives you the opportunity to compare executed tasks with data in the System.
Selection Window
In the selection window you decide in which template application, environment and sub-environment the new function should be placed. For this example:
Template Application: COB Cost object/Calculation
Environment: 001 Cost Estimates/Production Orders
Sub-environment: 102 Order Data
In section
Defining Environments and Function Trees
, choose
:
In the
Template Application
field enter: COB All environments and sub-environments that exist within the chosen template application are listed in the screen area to the left.
Expand the Environment 001;
Cost Estimates/Production Orders
and also the structure node
Order Data
Select the structure node.
Choose
In dialog box
Creating functions
, enter a description for the new function:
Order_Yield_Confirmed
Choose
Lower level
The tab index of the function transaction appear on the right screen area.
Make your entries using the tab index.
Basic Data Tab
Here, you describe the function and can also create documentation for it.
Description: Confirmed period based order quantities .
Logical Function Name: K_ABC_GET_ORDER_CONFIRMATION
Environment: 102
Namespace: Select using F4
Click on the documentation Icon (
) to create documentation for the function.
For more information, see Functions – Basic Data and Languages .
Implementation Tab
Choose the function module, to which the results of the function should be delivered You determine, therefore which data the function should supply. We are assuming here, that the appropriate function module exists.
ABAP Function Name: Select the function module: K_ABC_GET_ORDER_CONFIRMATION using F4.
Result type: The function module delivers a numerical value, therefore select Num. Value/String
F4 possible entries for comparison/parameters: in the
Possible Entries
field Enter
QUANTITY
Effect: The following is achieved by this entry: when defining Methods (activation) as a comparison operand 2 all functions contained by the data element QUANTITY are displayed (See Section: Results).
For more information, see Realization of the Function .
Parameter Tab
Here, you determine exactly which data the function should supply. You indicate among other things to which fiscal year and which controlling area the data should belong.
ABAP Function: K_ABC_GET_ORDER_CONFIRMATION
ABAP Parameter: Invisible parameters (default values in brackets): Order confirmation number (Order confirmation number), fiscal year (current fiscal year), controlling area (Function ORDER_CONTROLLING_AREA), order number (function ORDER_NUMBER)
Literal:
Confirmation quantity type
, F4 data element
QUANTITY
. This entry in the column
Possible Entries
means that when selecting comparison parameters ( see section Results) only functions where the data element
QUANTITY
was entered, in the possible entries field on the implementation tab, are selected.
For more information, see Function Parameters .
Uses Tab
On this tab you determine in which cells of the template the function can be used.
On the overview tab select
Quantity
and
Activation
for the cells
Business process, Calculation row (business process)
and
Flexible function (business process)
.
Goto the
All Columns
tab.
Deselect the ticks from the columns
Plan Activ
. and
Plan Qty
.
In the lines
Business process, Calculation row and Flexible functions
of the column
Actual Qty
, choose
and select
Formula component
. The function can then be used as an element of a formula for quantitive determination.
In the column
Act Acty
use
to select
Column heading
and
column entry
. This means that the function can be used as comparison operand 1 and 2.
For more information, see Function Uses .
Function Hierarchy Tab
On this tab you enter within which function trees the function should be contained.
For more information, see Additional Function Trees .
Language Tab
Enter external, language dependent descriptions for the functions in different languages, for example Confirmed period based order quantities and Periodengerecht rückgemeldete Menge für Auftrag.
For more information, see Functions – Basic Data and Languages .
Result
Y ou can now use the function in template maintenance to compare confirmed order quantities and total order quantities.
Column: Actual Activation
Comparison operand 1 = Function
Order Yield Confirmed
with parameter
Confirmed Yield
This function can be selected as a parameter, because you also selected the F4 data element QUANTITY (see section above: Parameter).
Unlike
Comparison operand 2 = Function Total Order Quantity. This function can be chosen as the same F4 data element was selected as with the Confirmed Order quantities (F4 Help Possible entries for comparison/parameters on Implementation tab), namely the data element QUANTITY (see section above: Implementation Tab).
This means that the quality process will only be activated when the confirmed order yield deviates from the total order quantity.
Column: Actual Quantity
in the column Actual Quantity you can enter a 1. This means that a new quality process will be executed, everytime the activation criteria are met.