Entering content frameProcedure documentation Defining Rules Using Function to Be Executed Locate the document in its SAP Library structure

Use

You use function modules for defining agent determination rules when very complex selection criteria, which cannot be depicted by other rule categories, are required for agent determination.

Prerequisites

    1. The rule container transferred as the table parameter AC_CONTAINER is read using the macro commands SWC_GET_ELEMENT and SWC_GET_TABLE.
    2. If you want to have the macro commands available, you must integrate the Include <CNTN01> as a sub-report for shared use. <CNTN01> mainly contains the macro command definitions for creating and processing a container instance.

      For further information, see Structure linkMacro Commands for Processing a Container Instance in a Program and Structure linkMacro Commands for Accessing Objects, Attributes, and Methods.

    3. The rule parameters are used to determine the responsible agent(s). At its simplest, this sub-program consists of a loop on a (Customizing) table, from which the agent is selected.
    4. The table ACTOR_TAB is filled.

For an example of such a function module, see Function Module for Rule Resolution.

You are on the Rule: Change or Rule: Create screen.

Procedure

  1. Enter a short description and a name for the rule.
  2. As the rule category, choose Agent Determination: Function to be Executed.
  3. Enter the name of the function module.
  4. Note

    If you want to evaluate the organizational structure, use the function module RH_GET_STRUCTURE. For more information, see Defining Rules Using Evaluation Paths.

    Example

    The function module delivered by SAP, SWX_GET_MANAGER, determines the manager of an employee, based on the organizational plan.

  5. Switch to the Container This graphic is explained in the accompanying text tab page.
  6. Choose This graphic is explained in the accompanying text.
  7. The Change Container Element dialog box appears.

  8. Make entries in the Element, Name, and Short Description fields.
  9. Create either an object reference or an ABAP dictionary reference for the container element. As a guide, use the data type reference of the container element of the workflow or task container from which the container will be filled at runtime.
  10. On the Properties tab page, set, if required, the Obligatory and/or Multiline indicators.
  11. Repeat steps 5 to 8 until you have defined all the necessary elements for the rule container.
  12. Save the rule.

Result

When the rule is executed, the function module receives the container elements from the rule container, and returns agents as a result.

For an example of this kind of rule, see the Rule for Determining the Manager of a User.

Leaving content frame