Pieter Rijlaarsdam
Read all my blogsWithdrawing SAP workflow tasks using paramaterized events
In one of the posts in 2011, I discussed using custom objects in SAP Workflow.
One of the things you can do with custom BOR objects, is add a custom event. The custom event can easily be raised using function SWE_EVENT_CREATE. You can use events to start workflows, but also to for instance influence an already running workflow on the specific instance of the object. You can implement the raising of an event using this function easily using for instance actions in transactions or using transaction events.
- Chance_of_success_changed with parameter
- Status_changed
In order to be able to withdraw the workflow task when the status is changed to ‘lost’ or ‘won’, I would use the stop mechanism as explained here.
As the event is ‘Status_changed’, and we do not want to withdraw the workflow on all status changes, I would create a parameter on the event ‘new_status’. We fill the workflow container before calling function SWE_EVENT_CREATE using ‘swc_set_element’ (from include <cntn01>) lt_container new_status <value> and transfer the container as parameter ‘event_container’.
In the parallel path for the stop mechanism, I implemented a while loop in which the workflow is listening to the event status_changed. The parameter new_status is bound to a parameter in the workflow container called ‘status_from_event’. The while loop continues until the status_from_event equals ‘won’ or ‘lost’. If this condition is met, the while will be ended and the parallel path will continue ending the outstanding workflow task.