During the execution of workflow it is possible to that workflow instance execution is interrupted due to an error. Usually this may be a programming error or any other unexpected situation. The errors can be easily detected in workflow log transaction (SWI1)
In the detail view of workflow log we see can see the error details.
Here we got an error in the execution of background task because of a syntax error in the method of a class.
This situation is not desired and workflow hangs out with error. It's possible to fix programming error for future runs of the workflow but what about the current errornous ones? SAP provides transaction SWPR in order to recover workflows that got error.
In SWPR it's possible to search by workflow definition or workitemid or by date
When we run the report in the second screen we see the list of workflows that got error
We can select the worklfow instance(s) that we want to restart. When we click on "Restart Workflow" workflow the workflows we selected are executed.
The good thing is that workflow is not started from the beginning. Only the step that got error is executed. This avoids the previous steps to be executed again and undesired result as a result of repeated execution of steps.