Wednesday, July 22, 2015

Exception handling in SAP Workflow

Last week I showed how to instantiate an object in SAP Workflow.

What if the instantiation of the object fails? In our case, the user might not exist in the system anymore... So I would feed the object username, and the system would respond with 'Computer says no'?

If you would do nothing, the workflow would break.



Fortunately, there is an easy way around.
Workflow standard supports exception handling.
Make sure your BOR method contains exceptions in the definition.


Make sure you raise the exception in the BOR object when it occurs.



You can catch these exceptions in the tab 'Outcomes'.


In your workflow, this will look like this. Real nice, you can now actually handle your exception by for instance notifying someone, or maybe finding a different responsible person for the next workflow task.


Your workflow will now continue, even if in this case the object did not exist.

No comments:

Post a Comment