Using Substitution Rules with the BPM API 
With the Business Process Management (BPM) application programming interfaces (APIs), you can customize and enhance the way you use business processes and execute tasks.
This document describes how you use the BPM APIs to create, read, update, and delete substitution rules.
Substitution rules allow users to act as substitutes of other users.
For example, you can:
Assign another user to manage your task
Receive (fill in) your task
Create multiple substitution rules to cover all options
Accept tasks from other users.
The substituted user is the user whose tasks are taken over by another user. The user who is taking over these tasks is named as substitute or substituting user.
For a detailed description of the BPM public APIs, see http://help.sap.com/javadocs/.
You need special authorizations to create, read, update, and delete substitution rules. For each operation a permission check is defined in the SubstitutionRulesManger of the BPM public API. If the user does not have the authorization for an operation, an exception (BPMIllegalAccessException) is thrown.
For more information about authorizations, roles and actions, see Authorizations and Roles.
To perform read operations on substitution rules, the SAP_BPM_Substitution_ReadAll action must be assigned to your user. As substituted you are also authorized to perform read operations but with restrictions: For rules that potentially return multiple substitution rules, the result set only contains rules, for which the caller is authorized. When querying for user information, the executing user must be the same as specified as query parameter.
To retrieve information about substitution rules, the SubstitutionRulesManger of the BPM public API provides the following get methods.
getActiveRulesBySubstitute
Retrieves all active rules for which the given user is the substituting user.
getActiveRulesBySubstitutedUser
Retrieves all active rules for which the given user is the substituted user.
getRules
Retrieves all substitution rules that matches the given parameters. Each parameter may be null - in that case these parameters will be ignored in the search query.
getRulesBySubstitute
Retrieves all rules for which the given user is the substituting user.
getRulesBySubstitutedUser
Retrieves all rules for which the given user is the substituted user.
getSubstitutedUsers
Retrieves all the users who the given substitute is substituting. Checks only active rules.
getSubstitutedUsersIds
Retrieves all the IDs of the users who the given substitute is substituting according to an active substitution rule.
getSubstituteUsers
Retrieve all the users who are substituting the given substituted user. Checks only active rules.
getUsersByActiveRules
Maps the given users to a matching set of users currently in charge as defined by substitution rules. The returned set contains the substituting user for a given user, or if there is none, the given user itself.
To create a substitution rule, the SAP_BPM_Substitution_CreateAll action must be assigned to your user or user role, or you are the substituted user.
With the createRule method, you can create a new substitution rule. This substitution rule is not automatically persisted. To persist it, use the ruleStore method.
To modify a substitution rule, the SAP_BPM_Substitution_UpdateAll action must be assigned to your user or user role, or you are the substituted user in both, the current and the modified version of the rule.
To delete a substitution rule, the SAP_BPM_Substitution_DeleteAll action must be assigned to your user or user role, or you are the substituted user.