Most of the workflow activities are triggered by an event such as a order creation or a closure. Can a workflow be triggered based on time, meaning if a service order is created, if a particular user status is not set within a particular time then a workflow to be triggered.
The immediate answer to this is No. A workflow can not be triggered if an object does not change to a particular status. At least not using the standard SAP tools that are provided. However, this is not to say that there is no way to implement this functionality. We can use the standard deadline monitoring functionality in conjunction with some of our other ?tools? to implement this.
Lets say, for the sake of the example, that we want to trigger a workflow if its status has not been set to TECO (technically complete) 2 days after it has been created.
As I see it there are 2 approaches in order to implement this functionality.
1. We could create a batch report which executes nightly (or every two days). The report could select all the Service Orders that were created on SY-DATUM ? 2 and that do not have a status of TECO. Once all those records are selected, the report could kick off a workflow for each Service Order which has not been Technically Complete. The workflow could be kicked off by using an event (using macro swc_raise_event) or by kicking the workflow off manually using Function Module SWW_WI_START_SIMPLE.
One of the benefits of this approach would be that you could easily tune the SELECT statements to ensure program efficiency.
The drawback to this approach is that the workflow wound only be kicked during the batch run. This may be acceptable but if it is not then you will need to take a look at option 2.
2. The second option would be to kick off a workflow for each Service Order created, wait till the deadline expires and then check its status to see if its status has changed. If the status has changed then terminate the workflow.
The drawbacks to this approach are
- The system may experience performance issues if a large number of Service Orders are created.
- Overhead of kicking a workflow off which may do nothing. This is because if the status has changed to TECO then we simply terminate. I suspect this would the case most of the time hence the unnecessary overhead.
The benefits of this approach
- The system will react immediately when the deadline expires. There is no need to wait till the nightly batch for the workflow to be kicked off.
Note: If you were to choose option 2 then here is an implementation tip. I would use a parallel fork in the workflow which does the wait and listens for the status change event (which can be configured using transaction BSVZ)). This way, as soon as the Service Order changes state, an even is raised and the workflow will terminate. This will prevent workflow from ?hanging around? unnecessarily.
Dig Deeper on SAP workflow development
Related Q&A from Alon Raskin
Find out how to configure clients so that the same version of an SAP workflow item is used when the workflow is triggered in separate clients.continue reading
An SAP user has created a user decision step in an SAP workflow item and wants to know how an end user can send an attachment to other users.continue reading
A SearchSAP.com reader wants to know how to hide the forward button in an SAP Business Workplace toolbar.continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.