Sunteți pe pagina 1din 21

Rule Resolution

Use
Using Rules, you can specify data at runtime according to a template defined at
definition time. This can be used, for example, in SAP Business Workflow. The f
ollowing types of rule can be resolved:
Agent determination rules
WebFlow rules
By resolving an agent determination rule in SAP Business Workflow you can, for e
xample, determine the responsible agents of a work item who have certain charact
eristics. You use WebFlow rules to determine elements of the pipeline for a Web
Activity.
Integration
The tools used for the Definition of an Agent Determination Rule or the Definiti
on of a WebFlow Rule are part of the Organizational Management component. SAP Bu
siness Workflow and mySAP Customer Relationship Management use rules as standard
.
Features
The system performs rule resolution. It is first performed at runtime depending
on and using information from the process currently running.
In a workflow step, the rule Orders Administrator for Customer <Customer> as of
Order Amount <Order Amount> is used.
If customer "Miller Ltd." and order amount "$34,569.34" are determined for a spe
cific order, the agents are determined at workflow runtime who are the "orders a
dministrator for customer Miller Ltd. as of order amount $34,569.34".
The principle of rule resolution is always the same:
The contents of the rule container are read.
The rules resulting from the rule category are applied to this data.
The result of the rule resolution is returned in an internal table. In the case
of agent determination rules, this table contains the agents as Organizational M
anagement objects (user, person, position, job, organizational unit) in any orde
r.
The category of the rule determines exactly how rule resolution is performed. Yo
u can determine the category when defining a rule.
Rule Resolution
Use
Using Rules, you can specify data at runtime according to a template defined at
definition time. This can be used, for example, in SAP Business Workflow. The f
ollowing types of rule can be resolved:
Agent determination rules
WebFlow rules
By resolving an agent determination rule in SAP Business Workflow you can, for e
xample, determine the responsible agents of a work item who have certain charact
eristics. You use WebFlow rules to determine elements of the pipeline for a Web
Activity.
Integration
The tools used for the Definition of an Agent Determination Rule or the Definiti
on of a WebFlow Rule are part of the Organizational Management component. SAP Bu
siness Workflow and mySAP Customer Relationship Management use rules as standard
.
Features
The system performs rule resolution. It is first performed at runtime depending
on and using information from the process currently running.

In a workflow step, the rule Orders Administrator for Customer <Customer> as of


Order Amount <Order Amount> is used.
If customer "Miller Ltd." and order amount "$34,569.34" are determined for a spe
cific order, the agents are determined at workflow runtime who are the "orders a
dministrator for customer Miller Ltd. as of order amount $34,569.34".
The principle of rule resolution is always the same:
The contents of the rule container are read.
The rules resulting from the rule category are applied to this data.
The result of the rule resolution is returned in an internal table. In the case
of agent determination rules, this table contains the agents as Organizational M
anagement objects (user, person, position, job, organizational unit) in any orde
r.
The category of the rule determines exactly how rule resolution is performed. Yo
u can determine the category when defining a rule.
Definition of an Agent Determination Rule
Use
You use this function if you want to define more rules in addition to the agent
determination rules delivered by SAP.
Prerequisites
If you want to use the rule in a workflow, you must be familiar with workflow de
finition and with the organizational environment in which the workflow will be u
sed. This means you are capable of determining a suitable rule category for each
workflow step.
Features
When defining an agent determination rule, you specify the following:
Which information must be available so that rule resolution can be performed whe
n the workflow is executed.
This information constitutes the rule parameters. They are defined as elements o
f the rule container.
The regulations in rule resolution that are used to determine the appropriate em
ployees.
The rule resolution procedure is specified by the rule category.
The rule container of all rules performed at the same time contains the export e
lement _RULE_RESULT. After the rule has been executed, the export element contai
ns the result. You can use binding to transfer the result to the workflow contai
ner where it can be put to further use. This is only necessary if you still need
the agents responsible for the step in the further course of the workflow.
Rule Category Agent Determination: Responsibilities
When rule resolution is performed, an assignment table is evaluated in which Org
anizational Management objects (jobs, positions, users, organizational units) ar
e assigned to the various versions of the rule parameters. This assignment table
was explicitly created during rule definition.
For more information, see Defining Rules Using Responsibilities.
Rule Category Agent Determination: Organizational Data
When rule resolution is performed, the system evaluates SAP organizational objec
ts, such as materials controller, planner group, shipping point, or sales office
, which are maintained in the master data of an application object.
This type of rule resolution requires the use of a separate maintenance transact
ion independent of rule definition to create assignments between the SAP organiz
ational objects and the organizational objects in Organizational Management (job
s, positions, users, organizational units) with which they are related.
For more information, see Defining Rules Using Organizational Data.
Rule Category Agent Determination: Function to be Executed
When rule resolution is performed, a function module is accessed that facilitate
s evaluations as required. The function module evaluates a table that is maintai
ned in Customizing. The function module must adhere to a given interface, and is
specified during rule definition.
For more information, see Defining Rules Using Function to be Executed.
Rule Resolution Based on Evaluation Paths
When rule resolution is performed, the system uses information that is available
in Organizational Management on the basis of relationships between individual o
bjects that are maintained in an organizational plan.
This information can be used, for example, if you need to determine the head of
an organizational unit, or the remaining members of the organizational unit, sta
rting from the initiator of the workflow.
From a technical perspective, this rule resolution is a special case of the Rule
Type Agent Determination: Function to be Executed. You use the function module
RH_GET_STRUCTURE. In addition, you must enter an evaluation path.
For more information, see Rule Resolution Using Evaluation Paths.
Rule Category Agent Determination: Function to be Executed Asynchronously
When performing rule resolution, the system calls an ABAB class, which allows as
many evaluations as required. The ABAP class must support the interface IF_SWF_
IFS_ASYNCHRONOUS_RULE. The work item is created with the initial status Ready, a
nd has no recipient. If the rule has determined responsible agents, they are fed
into the work item. The system determines the recipients, and they receive the
work item in their workflow inbox.
For more information, see Defining Rules Using Function to be Executed Asynchron
ously.
Rule Category Agent Determination: Organization Model
This rule category is currently only used in the environment of mySAP Customer R
elationship Management. For further information, see the SAP Library under BBP/C
RM -> Customer Relationship Management -> Organizational Management in CRM -> De
termining Organizational Data -> Rule Resolution using the Organization Model.
Defining Rules Using Responsibilities
Use
With this rule category you can select agents based on values from the workflow
or the task. To do this, you transfer container elements from the task or workfl
ow container to the rule container using binding. In the rule you define respons
ibilities that relate Organizational Management objects (job, position, organiza
tional unit, user, and so on) with possible values from container elements in th
e rule container.
A responsibility is itself an organizational object that requires no Customizing
settings and no ABAP source text.
Prerequisites
Before you define a rule using responsibilities, you must know the task or the w
orkflow step whose agents you want to determine using the rule. You need informa
tion about the container elements used in the workflow/the task, so that you can
use them in your responsibility rule.
You are on the Rule: Change or Rule: Create screen.
Procedure
On the Rule Definition tab page, choose the category Agent Determination: Respon
sibilities, and assign an abbreviation and a name for the rule.
Creating Rule Containers
The Rule Container must contain the container elements whose values you want the
system to check when the rule is executed. At runtime, binding fills the rule c
ontainer with data from the task or workflow container. To create the rule conta
iner, you therefore need to know the definition of the task or workflow containe
r.
Creating a Responsibility
With a responsibility you define the container element values that you want to t
rigger processing by the same users. In the responsibility, you define values or
value ranges for the container elements of the rule container. If you wish, you
can assign a priority to each responsibility.
Assigning Users or Organizational Objects to the Responsibility
You assign Organizational Management objects to a responsibility. These are then
returned as the result of the rule, if the responsibility check is positive.
If you only want the rule to return users or persons who are directly assigned t
o the responsibility, set the Personal Rule flag. Otherwise the rule also return
s users who are indirectly assigned to the responsibility (for example via an or
ganizational unit).
During rule resolution, the system evaluates only the responsibilities with the
highest priority. If no agent is determined, rule resolution is terminated. If t
he Take secondary priorities into account flag is set, rule resolution is not te
rminated. Instead, the system also evaluates responsibilities with a lower prior
ity.

All responsibilities with the same priority are evaluated independently, and the
respective agents determined are all returned as a result.
If you want the workflow to receive the Error status if rule resolution does not
produce a result, set the corresponding flag. For more information, see Cancell
ation for Rule Resolution Without Result.
Creating Rule Containers
Use
The rule container must contain all the container elements for which you want to
define responsibilities. At runtime the system fills the rule container from th
e workflow or task container using binding.
Prerequisites
You are on the Rule: Change or Rule: Create screen, on the Container tab page.
You know the Data type references of the workflow or task container elements tha
t you want to transfer to the rule container.
Procedure
Choose .
The Change Container Element dialog box appears.
Make entries in the Element, Name, and Short Description fields.
Create either an object reference or an ABAP dictionary reference for the contai
ner 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 runti
me.
On the Properties tab page, set, if required, the Obligatory and/or Multiline in
dicators.
Repeat steps 1 to 4 until you have defined all the necessary elements for the ru
le container.
Creating a Responsibility
Prerequisites
All container elements whose values you want to check in a responsibility at run
time must be defined in the Rule Container.
You are on the Rule: Change or Rule: Create screen, on the Responsibilities tab
page.
Procedure
Choose .
The Create Responsibility dialog box appears.
Enter an abbreviation, a name, and the validity period of the responsibility and
confirm your entries.
The Change Responsibility for Rule <.....> screen appears. In this responsibilit
y editor, all container elements in the rule container are listed.
Enter a single value or a value range for the container elements whose content y
ou want the system to check during rule resolution. If you want to check several
single values or value ranges for one container element, you can create new ent
ry rows. Position the cursor in a row with the container element for which you n
eed a new row, and choose .

If you do not want to check a container element for a particular responsibility,


leave this line blank. The status of the responsibility is set to Responsibilit
y incomplete, in order to draw your attention to unchecked container elements.
If you wish, give the responsibility a priority.
The responsibilities with the highest priority are evaluated first. Responsibili
ties with lower priorities are only evaluated if this is defined in the rule def
inition.
Choose Save.
Assigning Users to the Responsibility
Prerequisites
You must first Create a Rule Container and then Create a Responsibility, in whic
h you define criteria for the container values. Then you assign Organizational M
anagement objects to each responsibility.
Procedure
You are on the Responsibilities tab page.
Select the responsibility to which you want to assign an Organizational Manageme
nt object, and choose .
The Selection dialog box appears.
Select an object type that you want to assign as an agent and choose Continue.
The system asks you to enter a search term and to create the relationship betwee
n the responsibility and the selected object. Confirm your entries.
In the Overall View, you can also specify a validity period for the relationship
.
Defining Rules Using Organizational Data
Use
An application object (business object) is often related to particular users in
the system (such as MRP controller, laboratory, sales group, purchasing organiza
tion, or planner group) by virtue of its master data. The SAP system uses Organi
zational Object Types to depict this relationship. These are object types from t
he Business Object Repository for which the Organizational Type flag is set.
The corresponding business object type must have an attribute that refers to thi
s organizational object type. The organizational object type also has an attribu
te that refers to Organizational Management Objects.
In this rule category, the system evaluates this dependency to determine the res
ponsible agents for a business object. Concrete Organizational Management object
s (for example, positions or organizational units) must be assigned to the organ
izational object.
Rule resolution returns one or several Organizational Management objects as a re
sult.

There are some changes required to be made to material master data.


This task should be performed by an employee in the Laboratory/Design Office tha
t is stored in the material master data. SAP delivers the rule LABOR as an examp
le of a rule for agent determination using SAP Organizational Objects. For more
information, see Rule to Determine Laboratory/Design Office.
Procedure
If no suitable SAP organizational object exists, create one.
For more information, see Creating SAP Organizational Object Types.
Create a relationship between Organizational Management objects and the SAP orga
nizational objects.
This step must always be performed because you set up Organizational Management
objects in a specific way for your enterprise. For more information, see Creatin
g and Editing SAP Organizational Object Assignments.
Define the rule for evaluating this relationship. Do this as follows: on the Rul
e: Create or Rule: Change screen, enter under Rule category Organizational data
and under Org. Object Type enter the SAP organizational object type whose relati
onship you want to evaluate with this rule.
The corresponding rule container is automatically generated, and contains only t
he container element Org_Object_ID. At runtime, this container element must cont
ain the object reference to the organizational object whose relationship is to b
e evaluated.
Result
The rule for agent determination that you created is complete and can be used in
SAP Business Workflow. When using this rule, you must define binding from the w
orkflow or task container to the rule container. For further information, see Bi
nding Definitions from Workflow Container and Binding Definitions from Task Cont
ainer.
For an example of this kind of rule, see the Rule to Determine Design Office.
Creating SAP Organizational Object Types
Use
An SAP organizational object type describes the organizational unit that is resp
onsible for a business object type. This organizational unit consists of objects
from Organizational Management. The business object type must have an attribute
that refers to an SAP organizational object type.
The following graphic shows how the SAP organizational object type is used when
determining agents.
http://help.sap.com/saphelp_nw04/helpdata/en/75/069a6d770c11d3b536006094b9c9b4/f
rameset.htm (2443 image)
Prerequisites
The business object type exists in the Business Object Repository.
Procedure
Create an object type with the Business Object Builder and define the object typ
e as SAP organizational object type. For further information, see Business Objec
t Builder and Editing the Basic Data of an Object Type.
Support the interface IFSTROBJCT. Through this interface, this object type inher
its the Agents attribute. This attribute returns the Organizational Management o
bjects that are related to the SAP organizational object. No programming is nece
ssary for the support.
Add to the business object type an attribute that refers to your SAP organizatio
nal object type. For more information, see Extending and Adapting Object Types.
Result
You can use the SAP organizational object type you created to define an agent de
termination rule of the organizational data category.
When determining the responsible agent for a step in the context of a workflow d
efinition, you can also use the following multi-level expression, which uses the
SAP organizational object type.
&<BusinessObjekttyp>.<Organisationsobjekttyp>.Agents&

On the entry screen for Responsibility, select Container and enter &Material.Lab
or.Agents&.

This procedure means there is no need to define or use a corresponding rule.


When this step is performed, the following error situations can arise after the
expression has been evaluated:
The responsible agent that is determined does not belong to the possible agents
for the underlying task.
If this error occurs, nobody receives the work item.
The relationship between the organizational plan and organizational object (see
above) is not maintained, or not maintained in full.
If this error occurs, the system addresses the work item to all possible agents.
Creating and Editing SAP Organizational Object Assignments
Use
So that you can define rules using organizational data, you must create and edit
assignments between SAP Organizational Objects and Organizational Management or
ganizational objects.

You want to restrict the task of buying certain materials to certain individuals
within a specific organizational unit. This is achieved by creating an assignme
nt between a purchasing group (purchasing groups are SAP Organizational Object T
ypes ) and an organizational unit.
You can create assignments between any object classified as an SAP Organizationa
l Object, and the Organizational Management objects (organizational units, posit
ions, jobs, and work centers). You apply a validity period to these assignments,
so that changes in responsibility can be shown.
Prerequisites
The SAP organizational object types must be defined in the Business Object Repos
itory. For more information, see Editing the Basic Data of an Object Type.
In Organizational Management Customizing you must specify which Organizational M
anagement objects can be assigned to an organizational object type. For more inf
ormation, see Organizational Management Administration.
If you want to assign an organizational object type to an Organizational Managem
ent object that is not an organizational unit (for example, job or position), yo
u must know an organizational unit in which it is used. Organizational Managemen
t objects to be assigned are always selected via an organizational unit.
Procedure

Assignments between SAP organizational objects and objects from Organizational M


anagement can also be created in Infotype 1208, or using the function module R
H_SAP_ORG_OBJEC_RELATE .
Creating Assignments
From the SAP menu, choose Tools ® Business Workflow ® Development ® Definition tools ® O
rganizational Management ® SAP Org. Objects ® Create Assignments.
The Initial Screen: Assignment to SAP Organizational Objects screen appears.
Select the Organizational unit for which you want to create an assignment, or th
at contains the Organizational Management object for which you want to create an
assignment. If necessary, choose a Selection period.
Choose one or more SAP Organizational Object Types for which you want to create
an assignment. You have the following options:
Organizational object type
You can only create assignments to objects with this one SAP Organizational Obje
ct Type. This reduces the number of steps you perform later, if creating assignm
ents.
All organizational object types
You can create assignments to objects with any SAP Organizational Object Type.
Choose .
The Assignment to SAP Organizational Objects: Change screen appears. The system
displays the organizational unit and all the Organizational Management objects t
hat are related to it.
Select the Organizational Management object you want to assign to an SAP organiz
ational object.
Choose .
If you choose All organizational object types in step 3, the Choose organization
al object type dialog box appears. Enter the organizational object type to which
you want to create an assignment.
In the next dialog box, choose a specific object to which you want to create the
assignment.
The system creates an assignment between the two objects with unlimited validity
.
If you want to put a time limit on the validity of the assignment, select the SA
P organizational object and choose . In the dialog box that appears, choose a de
limitation date on which you want the assignment to become invalid, and then cho
ose Delimit.
Delete Assignment

Only delete object assignments that were created incorrectly or by accident. To


depict changed responsibilities, you must delimit the assignment, and create a n
ew assignment.
Select the SAP organizational object whose assignment you want to delete.
Choose and confirm the confirmation prompt.
Rule to Determine Design Office
The step Material Master: Maintain Design Data in a workflow should always be pr
ocessed by the MRP controller responsible for the material. The material to be p
rocessed is described by the business object type BUS1001, which is referred to
in the workflow container by the container element Material. The business object
type BUS1001 has an attribute, Laboratory, which refers to the SAP organization
al object type T024L.
At definition time:
As the rule for the responsible agent in the step Material Master: Maintain Desi
gn Data, enter the rule AC30100012 / Laboratory and define the binding from the
workflow container to the rule container. The SAP organizational object to be tr
ansferred is available as an attribute of the business object BUS1001. For bindi
ng, enter &Material.Laboratory& ® ORG_OBJECT_ID.
You must ensure that Organizational Management objects are maintained for the la
boratories that you refer to at runtime, via a material.

This rule is not available in a purely SAP NetWeaver system.


At runtime:
The material H4 Lamp, for example, is processed by the task. When the material i
s known, the system can find the user with the function of MRP controller for th
e material. That user is the responsible agent for the work item.
Defining Rules Using Function to Be Executed
Use
You use function modules for defining agent determination rules when very comple
x selection criteria, which cannot be depicted by other rule categories, are req
uired for agent determination.
Prerequisites
You have decided what you want the workflow to do. Depending on that, you decide
whether you want to use a function module delivered by SAP or a function module
of your own that suits your requirements exactly. To avoid having to display th
e source text of the function module during the procedure, you should be absolut
ely sure about which container elements are required by the function module befo
rehand. If you do need to check the source text of a function module, on the Rul
e: Display screen, choose Goto ® Function module.
The function module must enable the following process:
The rule container transferred as the table parameter AC_CONTAINER is read using
the macro commands SWC_GET_ELEMENT and SWC_GET_TABLE.
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 com
mand definitions for creating and processing a container instance.
For further information, see Macro Commands for Processing a Container Instance
in a Program and Macro Commands for Accessing Objects, Attributes, and Methods.
The rule parameters are used to determine the responsible agent(s). At its simpl
est, this sub-program consists of a loop on a (Customizing) table, from which th
e agent is selected.
The table ACTOR_TAB is filled.
For an example of such a function module, see Function Module for Rule Resolutio
n.
You are on the Rule: Change or Rule: Create screen.
Procedure
Enter a short description and a name for the rule.
As the rule category, choose Agent Determination: Function to be Executed.
Enter the name of the function module.

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

The function module delivered by SAP, SWX_GET_MANAGER, determines the manager of


an employee, based on the organizational plan.
Switch to the Container tab page.
Choose .
The Change Container Element dialog box appears.
Make entries in the Element, Name, and Short Description fields.
Create either an object reference or an ABAP dictionary reference for the contai
ner 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 runti
me.
On the Properties tab page, set, if required, the Obligatory and/or Multiline in
dicators.
Repeat steps 5 to 8 until you have defined all the necessary elements for the ru
le container.
Save the rule.
Result
When the rule is executed, the function module receives the container elements f
rom 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.
Function Module for Rule Resolution
The following excerpts from a fictitious function module for an agent determinat
ion 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.

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.
Interface of Function Module for Agent Determination
The interface of a function module for rule resolution is described by the follo
wing parameters:
Table Parameters
AC_CONTAINER, Reference Structure SWCONT
Rule container with rule-specific parameters that must be available as input val
ues for rule resolution.
ACTOR_TAB, Reference Structure SWHACTOR
Table with results of rule resolution as return values.
The SWHACTOR structure has the following logical appearance:
Field name
Type
Length
Short text
Otype
CHAR
2
Object type in Organizational Management
ObjID
CHAR
12
ID of object in Organizational Management

The structure consists of two fields:


OType includes a two-character character field that contains the identification
of the object type in Organizational Management. At this time, the following obj
ect types are permitted as the result of rule resolution:
O
Organizational Unit
S
Position
C
Job
A
Work center
US
User name
P
Person (PD master data)

The entries for OType are checked against table T779O.


ObjID includes a twelve-character character field that contains the identifying
name of a user and/or the unique ID (eight-digit number) of an object in Organiz
ational Management.
Exceptions
If the function module for rule resolution is exited via the NOBODY_FOUND except
ion, or the ACTOR_TAB table is returned empty, the status of the Cancellation fo
r rule resolution without result for further procedure indicator is decisive. Fo
r more information, see Cancellation for Rule Resolution Without Result.
Rule to Determine Manager
This standard SAP agent determination rule determines the manager of an object i
n Organizational Management. The rule uses the function module SWX_GET_MANAGER ,
which requires an Organizational Management object as an import parameter.
Use
Often, you use this rule to find the manager of the initiator of a workflow, or
the manager of the actual agent of a step. The _WF_Initiator element of the work
flow container and _ WI_Actual_Agent element of the task container are used to s
tore the user names in a fourteen-character text field in accordance with the RH
OBJECTS-OBJECT reference. Binding, therefore, must be defined for the Org_Object
element of the rule container.
As an example, rule 00000168 is also used in the example demo for processing a n
otification of absence. For more information, see Demo Example: Processing a No
tification of Absence.
Structure
Rule: 00000168
Abbreviation: Manager
Name: Manager of...

The SWX_GET_MANAGER function module is used to define this rule.


Integration
The organizational plan of the enterprise is used for rule resolution.
The link between an employee and his or her manager can be depicted in the organ
izational plan by two different relationships:
Indication of the chief position for an organizational unit (position "manages"
organizational unit, relationship A/B012 ).
Direct reporting structure between positions (position "reports to" position, re
lationship A/B002 ).
Defining Rules Using Function to Be Executed Asynchronously
Use
You use an ABAP class for defining an agent determination rule when you require
very complex selection criteria for agent determination that cannot be depicted
by other rule categories, and when you want to determine agents asynchronously.
The rule container, which is filled by binding, and the work item ID are transfe
rred to this rule. Then the system can transfer the result of the rule execution
to the initiating work item. This is done with the help of the function module
SAP_WAPI_ASYNC_RULE_COMPLETE.
Prerequisites
An ABAP class exists that supports the interface IF_SWF_IFS_ASYNCHRONOUS_RULE, i
n which the method INITIATE_EVALUATION is implemented and which calls agent dete
rmination. The ABAB class receives the necessary data from the workflow environm
ent via the rule container.
Procedure
Enter a short description and a name for the rule.
As the rule category, choose Agent Determination: Function to be Executed Asynch
ronously.
Enter the name of the ABAP class.
Switch to the Container tab page.
Choose .
The Change Container Element dialog box appears.
Make entries in the Element, Name, and Short Description fields.
Create either an object reference or an ABAP dictionary reference for the contai
ner 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 runti
me.
On the Properties tab page, set, if required, the Obligatory and/or Multiline in
dicators.
Repeat steps 5 to 8 until you have defined all the necessary elements for the ru
le container.
Save the rule.
Result
If you execute a rule of this type, the work item is created with the initial st
atus Ready, but it has no recipient. First, the rule must determine agents. The
system then transfers the agents to the work item, and determines the recipients
of the work item. All recipients can now see the work item in their workflow in
box.
Defining Rules Using Evaluation Paths
Use
The organizational situation of employees within an enterprise is depicted in th
e organizational plan. Using this existing information, you can perform rule res
olution starting from one particular employee to determine one other employee, o
r several other employees, along specific relationships in the organizational pl
an.
Prerequisites
The organizational plan and the Evaluation Path that you want to use exist. For
more information, see Maintaining Evaluation Paths.
You are on the Rule: Change or Rule: Create screen.
Procedure
Enter a short description and a name for the rule.
As the rule category, choose Agent Determination: Function to be Executed.
Enter RH_GET_STRUCTURE as the function module .
The Evaluation Path field is activated.
Enter the required evaluation path.
Switch to the Container tab page to create the Rule Container.
Choose Save.
Result
You have created a rule that determines an Organizational Management object by s
tarting from another Organizational Management object and following an evaluatio
n path. For an example of this kind of rule, see the Rule to Determine the Organ
izational Unit of a User.
If you want to use the agent determination rule to determine responsible agents
in a workflow step, you must define Binding from the Workflow Container to the R
ule Container. If you use the rule within a task, you must define Binding from t
he Task Container to the Rule Container.
Creating Rule Containers
Use
The rule container for an agent determination rule based on evaluation paths mus
t contain only the Organizational Management object for which the evaluation pat
h is to be applied. At runtime the system fills the rule container from the work
flow or task container using binding.
Prerequisites
You are on the Rule: Change or Rule: Create screen, on the Container tab page.
Procedure
Create the following container elements by performing the steps listed below:
Name
Data type reference
Description
OType
OBJEC-OTYPE
Type of the Organizational Management object
ObjID
OBJEC-REALO
ID of the Organizational Management object
Org_Agent
WFSYST-AGENT
Organizational Management object

Choose .
The Change Container Element dialog box appears.
Make entries in the Element, Name, and Short Description fields.
Create the required ABAP dictionary reference for the container element.
Repeat steps 1 to 3 until you have defined all the elements for the rule contain
er.
Result
The rule container contains elements with which an Organizational Management obj
ect can be transferred. At runtime either the container elements OType and ObjID
or the container element Org_Agent must be filled. If all container elements ar
e filled, only the value transferred in Org_Agent is evaluated.
Rule to Determine the Organizational Unit of a User
The recipients of a work item should be all users that belong to the organizatio
nal unit of a particular user.
At definition time:
As the agent determination rule for the agent responsible for the step, enter th
e rule Organizational Unit of a User ( FindOwnOrgUn / AC30000011 ). This rule us
es the RH_GET_STRUCTURE function module in conjunction with the WF_ORGUN evaluat
ion path ( organizational unit of a user/person).
In the binding from the workflow container to the rule container you transfer, f
or example, an expression that identifies the user as an Organizational Manageme
nt object.
You must ensure that the user is assigned to a position that itself belongs to a
n organizational unit.
At runtime:
At runtime the system uses the evaluation path to determine the user s organizatio
nal unit, and transfer it as the responsible agent. The recipients are the inter
section between possible and responsible agents.

By performing a suitable selection of possible agents for the task, you can, for
example, determine recipients who perform a particular activity within the orga
nizational unit. If, for example, the job Secretary is stored as a possible agen
t, and you use the rule to determine an organizational unit, all users who perfo
rm secretarial activities in that organizational unit become recipients of the w
ork item.
Cancellation for Rule Resolution Without Result
Empfängern
Definition
Indicator that determines how the system reacts if rule resolution fails to prod
uce a result.
Use
It is possible that rule resolution fails to find a valid user. Then rule resolu
tion triggers the exception NOBODY_FOUND , or returns an empty table.
If the indicator is set, the system gives the corresponding work item the status
Error.
If this indicator is not set, all Possible Agents of the work item become Recipi
ents.
The error situation is recorded in the workflow log.

Rule resolution is used to distribute invoices to various buyers at your enterpr


ise. Only Mr. Miller can execute this work item if the invoice amount exceeds $5
,000. If you set the Cancellation for rule resolution without result indicator,
and if rule resolution fails to find an agent for an invoice that exceeds $5,000
, the workflow is cancelled. Only the system administrator for workflow can rest
art it. If you do not set the Cancellation for rule resolution without result in
dicator, and if rule resolution fails to find an agent for an invoice that excee
ds $5,000, all buyers can process the invoice.
Selecting Objects from the Organizational Plan
Use
As well as defining agent determination rules, it can be necessary to describe c
ertain relationships between employees and areas of responsibility or the border
s between areas of responsibility in system tables. This information is then ava
ilable for rule resolution.

Create a table by assigning certain companies and invoice amounts to administrat


ors via their positions.
Position
Company
Amount ($)
50001234
A - H
0 50,000.-
50001235
A - H
> 50,000.-
50001236
I - Z
0 60,000.-
50001237
I - Z
> 60,000.-

If the name of the company and the invoice amount are known, the details in this
table are used for rule resolution, in order to find an administrator.
The following function modules are available, to ensure that you have access to
objects from Organizational Management that you need to fill the table and that
you can program possible entries.
Features
RH_DETERMINE_ORG_OBJECT
Determines the ID of any Organizational Management object.
Interface
Import Parameter
ORG_OBJECT , Reference structure SWHACTOR
Exceptions
NO_ACTIVE_PLVAR
NO_OBJECT_ID_SELECTED
NO_OBJECT_TYPE_SELECTED
This function module can be called without transfer parameters.
When you access this function module, a dialog box is displayed from which you c
an select an object type from Organizational Management.
Once you have selected an object type from Organizational Management, one of the
Organizational Management objects stored for this type can be selected and disp
layed using the search function.
The object type and ID of this Organizational Management object are returned as
an export parameter in the SWHACTOR structure and can be used in your applicatio
n.
RH_DETERMINE_ORG_OBJID
Determines the ID of an Organizational Management object from a predefined Organ
izational Management object type.
Interface
Export Parameters
ORG_OBJECT_TYPE , Reference field OBJEC-OTYPE
Import Parameter
ORG_OBJECT_OBJID , Reference field SWHACTOR-OBJID
Exceptions
NO_ACTIVE_PLVAR
NO_OBJECT_ID_SELECTED
This function module forms only the "second half" of the function module describ
ed above.
When you access it, you transfer the Organizational Management object type whose
possible values you want to display using the possible entries function. You tr
ansfer this Organizational Management object type as a one- or two-character ID.
Using the search function, you can select and display one of the entries stored
for the Organizational Management object type.
The ID of this Organizational Management object is returned as an export paramet
er in the variable ORG_OBJECT_OBJID and can be used in your application.
Definition of a WebFlow Rule
Use
WebFlow rules are used within a workflow in the basic data and in the Web activi
ty step type. Using a WebFlow rule you can individually execute the following pa
rts of a Web activity:
Determination of URL
Preparation of the XML document
Determination of the authentication data
Execution of the send procedure
Determination of transfer format
Prerequisites
To use a WebFlow rule, you must create an ABAP class. Depending on the type of t
he WebFlow rule, this class must support the following interfaces:
WebFlow Rule Type
Necessary Interface
WebFlow: Authentication
IF_SWF_XML_RULE_AUTHENTICATE
WebFlow: Sending
IF_SWF_XML_RULE_DATA_SEND
WebFlow: Preparation of the XML document
IF_SWF_XML_RULE_DATA_SET
WebFlow: URL determination
IF_SWF_XML_RULE_URL
WebFlow: Determine format (if group)
IF_SWF_XML_RULE_FORMAT

To see an example implementation, see the ABAP class CL_SWF_DEMO_WEBACTIVITY.

At the moment the rule type WebFlow: Signature is only used internally.
Features
If you use a WebFlow rule in a Web activity, the execution of the rule replaces
the usual process. Depending on the type of the WebFlow rule, the system automat
ically transfers particular data. For more information, see the appropriate inte
rface documentation.

In the WebFlow rules Send data and Prepare XML document, you can also make use o
f the standard process, executing your own process only in particular cases. The
methods for doing this are available in the class CL_WAPI_WEBFLOW_SERVICES.
Activities
You create a WebFlow rule by accessing the Rule: Change or Rule: Create screen.
Enter the abbreviation and the name of the rule, and select a rule type. Under O
bject type name, enter the ABAP class you created for the rule. You must transfe
r all additional data that you need for execution via the rule container. For mo
re information, see Creating Rule Containers.
Creating Rule Containers
Use
The rule container for a WebFlow rule must contain all additional container elem
ents that you need to execute the methods in the ABAP class. At runtime the syst
em fills the rule container from the workflow container using binding. For furth
er information about which data the methods contain as standard, see the interfa
ce documentation.
Prerequisites
You are on the Rule: Change or Rule: Create screen, on the Container tab page.
You know the data type references of the workflow container elements that you wa
nt to transfer to the rule container.
Procedure
1. Choose .
The Change Container Element dialog box appears.
2. Make entries in the Element, Name, and Short Description fields.
3. Create either an object reference or an ABAP dictionary reference for the con
tainer element. As a guide, use the data type reference of the container element
of the workflow container from which the container will be filled at runtime.
4. On the Properties tab page, set, if required, the Obligatory and/or Multiline
indicators.
5. Repeat steps 1 to 4 until you have defined all the necessary elements for the
rule container.

ies in the Element, Name, and Short Description fields.


3. Create either an object reference or an ABAP dictionary reference for the con
tainer element. As a guide, use the data type reference of the container element
of the workflow container from which the container will be filled at runtime.
4. On the Properties tab page, set, if re

S-ar putea să vă placă și