Workflow. Debugging Background Tasks. Transaction SWW_BREAKPOINT

Workflow. Debugging Background Tasks. Transaction SWW_BREAKPOINT

Introduction

Dear consultants, developers, and everyone else who has ever been involved in debugging background tasks in workflows —
Try to remember how many preliminary steps you used to go through just to trace the execution of a small portion of background task code within your workflow?

See also: SAP Workflow. Debugging Background Tasks
See also: Workflow. Отладка фоновых задач. Вредный совет

Remember now? Let’s forget all of that. To clarify — forget about all those preliminary steps.

What happened?

Turns out SAP cares about us: they finally added a background task debugging feature “for the people.” This great improvement has been documented under the following reference:

See: SAP Note 2197117 - Debugging of background work items
See: PDF version of SAP Note 2197117 - Debugging of background work items

Now there’s no need for questionable workarounds — it’s enough to launch transaction SWW_BREAKPOINT and follow a few required steps. A few words on that below.

Example 1

Let’s look at an example of debugging a background task in a workflow controlled by a class.

See: Workflow. Использование функциональных методов в потоках операций

The following video demonstrates the sequence of steps for creating a workflow for this purpose.

0:00
/1:33

Starting the Debugger

Set an external breakpoint in the method of the class where you want to start debugging.

Launch transaction SWW_BREAKPOINT.
On the selection screen, specify the workflow ID and the class (entering the method name in the EVENT field is optional). Then click the Save button.

N.B. Please note: If your workflow is triggered by an event from a class/business object, then in SWW_BREAKPOINT, you must specify the event name of the class/business object and place external breakpoints in the relevant methods.

Launch the workflow.

0:00
/0:20

Perfect.

Example 2

As another example, let’s look at debugging a task controlled by a business object method.

See: Implementation of Interfaces (BOR)

As the test workflow, let’s use the following:

0:00
/0:30

Just like in the previous example, place an external breakpoint in the method of the business object.

Enter the relevant parameters in transaction SWW_BREAKPOINT (again, the method name in the EVENT field is optional).

Launch the workflow.

0:00
/0:18

That was solid.