There are some useful patterns that implement features in SAP NetWeaver Composition Environment (SAP NW CE) that are not available out of the box.
Auto Put Back
Lets assume that there is a group of potential owners for a task. The first user that opens the task will be its exclusive owner. Until the task is not put back, it will never be visible for the other potential owners again. The assumption behind this exclusive task assignment behavior is that the task owner will immediately work on the task and complete it. But the owner might not be able to do that. With time cirtical tasks this can be an issue. A feature that puts back an exclusively assigned task after some configurable duration would solve the problem.
There is a simple solution for this requirement. Let’s look at the pattern below:
By defining a boundary ‘CompletionDeadLineIsCriticalException’ that is routed back to the same task you can define a certain duration until the task has to be completed. If the task is not completed in time the task will be automatically canceled and restarted. The task will then be visible for all potential owners again.
Warning: Don’t choose a short time interval as this solution puts additional load on the process server. Also consider that the task is canceled and restarted even if some user is processing it right now.
You can use an expression to set the duration dynamically based on task attributes the describe its criticallity. My recommendation is to calculate the duration in a way that the exception is triggered at a time with low system usage (e.g. at user night time).
The upper process model layout does not represent the routing back sequence connector properly but I’m of the opinion that implementing such a feature should not mess up your proccess models.
Now let’s look at the following business requirements:
- Business user wants to save process instances as “draft”
- Automated deletion of untouched “draft” process instances after a configurable time
The idea is to always actually start the process in the user interface with a “save as draft” button. This information is passed to the process context via the interface of the start event. If the user has selected the “save as draft” option he will get a task in the UWL with attributes that distinguishes it from running instance (e. g. subject “Draft”, no due date, etc.). For the automatic deletion requirement we use a CompletionDeadLineIsCriticalException boundary event. If triggered after the defined time period, the process instance is terminated.
Be aware that process analytics will of course consider this process as started, so you need to correct process cycle time accordingly.
The above process model brings solutions for more business requirements
Reuse of Instances
- Ability to reuse data from other process instances (running, completed, draft) for new processes
A solution for this requirement is to leverage reporting activities and reporting data sources to store process context data that is used in new process instances. You will need to create a ‘process picker’ user interface component in Visual Composer using the standard SAP and custom reporting data sources with the right filter criteria. The custom reporting data source is used to start new process instances populated with data from other process instances. Be aware that the user can only use data from other process instances if he was involved in that process.
Anytime Read Access
- Users must be able to look into the context of running process instances any timeeven if they don’t have a task in their inbox.
This is achieved by the already described process instance picker user interface, the parallel spilt gateway and the following intermediate message event. On the left branch of the parallel gateway the normal process flow is modeled which consists in this case of an “Enrich Request” and an “Approve Request” human activity. At the end the process instance data is saved into the custom reporting data source to be reused for new process instances as described above.
The interesting part is on the right hand side of the parallel split gateway. To look into the content of a running process instance the user starts the process picker in NetWeaver Portal and selects a process instance. In the next step the UI triggers the intermediate message event which creates a task in the UWL for the user. Ideally the UI directly invokes the task avoiding the detour via UWL. It might be necessary to wait for a moment until the task is created. You can use a dummy service with some sleep() function for that purpose.
The UI used in “Display Request” has to be a read only UI. After the “Display Request” task is executed the process waits on the next intermediate message event to be triggered. As the termination event on the left hand side kills the whole process instance there is no need to have a parallel merge gateway in the process model.
With a little effort it is possible to enhance SAP NW CE with some additional features. Be aware that some of the described patterns are not technology neutral. For example reporting data sources are not available in Web Dynpro Java. In the demontrated scenarios I used the process context for persistence. SAP does not recommend to do this if you have a large data model and/or high process instance volume. My purpose was to show what is possible out of the box without coding.
Stay tuned: In the next blog entries I will cover more useful patterns for ad-hoc processes, process administration and process synchronisation.