Having worked on Guided Procedures for a pretty complex Business Process, I was thinking about using BPM for the same process. The first thing I wanted to know was, ‘How to create Parallel activities with each instance getting the processor assigned dynamically?’ We could achieve this in Guided Procedures using Parallel Dynamic Block. In short I was thinking of checking the possibility of implementing something similar to Parallel Dynamic Block in BPM.In order to do this, I took a pretty simplified simulation of the Business Process we worked on.Something as follows:
Request Cycle Process
1. Requester submits the request
2. Request goes to multiple Validation departments for validation simultaneously (parallel validation). The departments are assigned to the instances dynamically
3. After all the departments validate the request, the request goes for approval
4. Approver approves the request
In this example we are just taking two departments for parallel validation. In real time scenario there can be more than two.!https://weblogs.sdn.sap.com/weblogs/images/36163/flow.JPG|height=327|alt=image|width=412|src=https://weblogs.sdn.sap.com/weblogs/images/36163/flow.JPG|border=0!
And this is how we start in BPM:
This process consists of 3 activities. All of them are ‘human Interaction’ activities in this example. The ‘Validation’ activity is the one which we want to have the parallel instances for. In real time scenario, this can be an Embedded sub-process, Automated, Referenced sub-process, Mapping or Reporting Activity.
Now,we will see the description/configuration of these activities and the Data Object:
1.Activity Name : Submit Request, Type : Human Interaction
User Interface : WebDynpro component RequestComp with a view RequestCompView having just a button ‘Submit Request’. On click of the ‘Submit Request’ button the ‘complete’ event gets fired so that the BPM understands that the task is over and it should start the next task.
Context Structure for this WebDynpro Component:
The node ‘ListOfIDs’ is used to populate the IDs of the ‘Validation Department’ groups which we will be using in the ‘Validation’ activity for mapping to the Data Object and for the Looping functionality. In that activity these groups will be assigned as the potential owners for the parallel instances of the ‘Validation’ activity.
Code in wdDoInit() method of this view(RequestCompView) :
Here we are just adding the Unique Ids in the ID attribute of ‘ListOfIDs’ Node. In real time scenario, we can populate this node by using the UME API to fetch the Groups and get their unique ids or by executing the RFC or webservice etc.
public void wdDoInit()
2.Data Object DO_ContextTypeINPUT:<br />Drag the ‘ContextTypeINPUT’ data type from the required <wd component>/port node under ‘Data Types’ node on the left panel and drop on the Process Designer. This will create the Data Object for us. This Data Object will have the Collection ‘ListOfIDs’ as we had the Context Node ‘ListOfIDs’ in our WD component for the Submit Request Task. We need this collection for configuring looping in the ‘Validation’ activity.</p><p style=”font-size: 10pt; font-family: Arial”>!https://weblogs.sdn.sap.com/weblogs/images/36163/dataobject.JPG|height=306|alt=Data Object|width=598|src=https://weblogs.sdn.sap.com/weblogs/images/36163/dataobject.JPG|border=0!</p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p style=”font-size: 10pt; font-family: Arial”> </p><p style=”font-size: 10pt; font-family: Arial”> </p><p style=”font-size: 10pt; font-family: Arial”> </p><p style=”font-size: 10pt; font-family: Arial”> </p><p style=”font-size: 10pt; font-family: Arial”> </p><p style=”font-size: 10pt; font-family: Arial”>Output Mapping for the ‘Submit Request’ activity:
Now we will do the output mapping for our Activity ‘Submit Request’. We will map the ‘ListOfIDs’ node from the TaskOutput->UIResponse node to the Data Object ‘DO_ContextTypeINPUT’ we created above. Due to this mapping, the Values of the attribute ID in the node ListOfIDs since we populated this node in ‘wdDoInit()’ of the ‘RequestCompView’ will be copied in the Process Context i.e. in the Data Object ‘DO_ContextTypeINPUT’ and hence will be available to the other Activities.