In this blog I would try to showcase a simple scenario which I have resolved with table driven dynamic parallel processing approach.
Definitely this scenario can’t be a production scenario. But I would expect going through the blog, would help to build some basic idea about this dynamic processing approach for Workflow beginners.
Scenario:Trigger workflow with multiple Sales Orders. Depending on the Sales Org, agent will be determined dynamically and work item will be sent to the concerned agent. After receiving the work item, agent can display the sales order. Part – 1
A Z program which will be executed with multiple Sales Orders and based on the Sales Org , work item will be distributed to different agent as determined dynamically.
Therefore three things I will address here:
1. Design a Work flow template using a ‘Block’ step (Tcode -: SWDD)
2. Create dynamic agent determination rule to determine agent to whom Work Item should be sent for. (Tcode: PFAC)
3. ABAP program to trigger the workflow created in step 1 (SE38 , Z Program)
Step 1: Design a Workflow Template using a block step as shown below
In this Scenario, as I said, I will be running the workflow with two Sales Orders. Used the BOR Object as BUS2032.
The template contains the basic items as below:
1. Block Step
2. User Decision Step
3. Task to perform some activities (In this case , display the sales order)
Assumption: Though , target audience here are workflow beginners, still I assume reader should have some basic knowledge about workflow building.
So no point to display all the steps as that would make the information bit clumsy.
A) Creating container element
I have a workflow container as below with Import and Multiple Check box as checked. The purpose of this workflow container is to contain
the given multiple sales order information.
B) Use a Block step as below:
Create a new block step with below settings:
I have taken block type as P (ParForEach), also in Parallel Processing tab I have Selected BUS2032 as Multiline Element.
C) Creating a user Decision step as below:
Here I have created the Title as ‘Do you want to display Sales Order &1’, and at the same time selected the Parameter 1 as &_BUS2032_LINE.SALESDOCUMENT&. You may noticed , I have used the Agent determination rule 95000010, which I will describe later.
As workflow container element “BUS02032” (Check Step ‘A’ ), will behave like an internal table , so line value is nothing but the work area is being passed to Rule determination procedure. Based on the line value (Sales Order Number ) , we will determine the Sales Org value of the document, and as per predefined rule I will determine the agent to whom the work item needs to be sent.
D. Create agent determination rule in transaction code “PFAC” as below:
I have created a custom function module to determine the agent as shown in the above screen shot. The underlined coding in the function module is attached here.
Now the important part is the binding. Means binding workflow container with task as well the rule. I have shown below:
E. Now I have used the “display” method of the business object BUS2032 to display the sales order content as below.
F. The workflow development is complete and now it is to be tested through SWUS. In my continuation blog I would execute this WF through SE38 program.
Executing the workflow with given data will generate two different work items and based on the Sales Org , the work item will be assigned to the concerned agent.
That’s All. I would appreciate if you can provide your feedback and suggestion if any better option / solution is possible to this scenario.
– Thanks , Somnath