Entering content frameThis graphic is explained in the accompanying text Function Module for Rule Resolution Locate the document in its SAP Library structure

The following excerpts from a fictitious function module for an agent determination rule, which determines the responsible agent on the basis of a release code and object to be released, can be used as an example.

The ReleaseCode and ReleaseObject elements are defined in the rule container as rule parameters.

Syntax

FUNCTION GET_REL_RESPONSIBLE.

*"----------------------------------------------------------
*"*"Lokale Schnittstelle:
*" TABLES
*" ACTOR_TAB STRUCTURE SWHACTOR
*" AC_CONTAINER STRUCTURE SWCONT
*" EXCEPTIONS
*" NOBODY_FOUND
*"----------------------------------------------------------

INCLUDE <CNTN01>.

* define variables stored in container
DATA: RELEASE_OBJECT TYPE SWC_OBJECT.
DATA: RELEASE_CODE LIKE RM06B-FRGAB.

* local data
DATA: BEGIN OF RELOBJECTKEY,
NUMBER LIKE EBAN-BANFN,
POSITION LIKE EBAN-BNFPO,
END OF RELOBJECTKEY.

REFRESH ACTOR_TAB.
CLEAR ACTOR_TAB.

* convert persistent container to runtime container
SWC_CONTAINER_TO_RUNTIME AC_CONTAINER.

* read elements out of container
SWC_GET_ELEMENT AC_CONTAINER 'ReleaseCode' RELEASE_CODE.
SWC_GET_ELEMENT AC_CONTAINER 'ReleaseObject' RELEASE_OBJECT.

* separate object key
SWC_GET_OBJECT_KEY RELEASE_OBJECT RELOBJECTKEY.

* loop and select table <TABLE> with
* RELEASE_CODE
* RELOBJECTKEY-NUMBER and RELOBJECTKEY-POSITION

* end of selection

* exception and parameter handling
  IF SY-SUBRC NE 0.
    RAISE NOBODY_FOUND.
  ELSE.
    ACTOR_TAB-OTYPE = <TABLE>-ACTOR_TYPE.
    ACTOR_TAB-OBJID = <TABLE>-ACTOR_OBJID.
    APPEND ACTOR_TAB.
  ENDIF.

ENDFUNCTION.

Leaving content frame