How to (not) debug workflow background tasks
This is a very common question in the discussion threads and I think I read more than 5 blogs suggesting different ways to debug the workflows. However, and this is an Update following the SAP customer connection Workflow Focus topic, there should now be an easy way to debug the background tasks – see note 2197117 – Debugging of background workitems – https://service.sap.com/sap/support/notes/2197117.
If you can’t implement the note, or want to try another way of solving the problem, there are a few steps you can use:
The first option is using the workflow log, one advantage of the workflow system is that it logs almost everything so in contrast to a regular program which you don’t know exactly what has happen to the user, in the workflow you can see in importing and exporting parameters in the log. When you build your workflows remember to also add the return messages of the function modules to the log so you can have the complete picture.
Sometime you use a parameter of the business object in a rule or an internal part of the task, add it as an attribute of the object so you can see it too in the log.
Second step you can do is to use the test option in SWO1 and debug the method, since the background task is actually a call to an object method, debugging the method in most cases is the same as debugging the task.
Another option before starting to debug tasks which is useful for all background process, not just the workflows (I actually use it mainly for the SRM workflow BADIs) is using log points, it’s very simple to add to your program:
Log point ID zlog_point_name SUBKEY im_object_num FIELDS field1 field2 etc.
And you will have the ability to log the data even in productions systems without using debugger. See for more detail:
Checkgroups – ABAP Development – SCN Wiki
Now only if all this failed go to solutions like changing the workflow RFC destination, adding endless loops in the program etc.
One stop point for WF debugging needs!
Good one Ronen!
Next time if anyone asks on SCN, I am gonna refer them here!