In this blog I would like to talk about creating custom rules in SAP Workflow.The rules can be created or changed using the standard SAP transaction
PFAC
.Once the rules are created you can call these rules in any workflow via the rule container.
In this article I am creating a rule which will find the superior for any user/agent.This information is maintained in a custom table ZUSERS.I have created a custom function module Z_FIND_SUPERIOR which will return me back a table containing all the superior information for a particular user/agent.One point to note here is that the custom function created should have the same interface as that of the SAP standard function module RH_GET_ACTORS.The following tables parameters have to exist in the custom function module.
ACTOR_TAB STRUCTURE SWHACTOR
AC_CONTAINER STRUCTURE SWCONT
Table ZUSERS
FUNCTION Z_FIND_SUPERIOR
FUNCTION Z_FIND_SUPERIOR.
*"----
""Local interface:
*" TABLES
*" ACTOR_TAB STRUCTURE SWHACTOR
*" AC_CONTAINER STRUCTURE SWCONT
*" EXCEPTIONS
*" NOBODY_FOUND
*"----
INCLUDE
Go to the "Container Tab" and create a container element for the agent/user which will be passed to the function module
Our rule is created now.You can test the rule within the PFAC transaction by clicking the "Simulation" button on the application toolbar.Now this rule is ready to be used in any workflow via the rule container of the workflow.