Workflow
ABAP Developmentadvanced

Workflow Part 5: Errors, Restart and Escalation

Key takeaway

Support workflows in production: typical error sources (event not started, binding, agent resolution, method exceptions), analysing with SWEL, SWI1, SWIA and SWI2 DIAG, restarting after error (SWPR), forwarding and completing work items administratively, deadline monitoring (SWWDHEX job) and escalation design.

Explanation

📌 KEY POINTS
✅ Error types: workflow didn't start (event/linkage/start condition), step in error (binding, method exception, agent not found), work item waiting (no agent, agent absent), deadline missed.

✅ Tools: SWEL/SWELS (event trace), SWE5 (event queue/errors), SWI1 / SWI2_DIAG (work items in error), SWIA (administrative actions), SWPR (restart workflows after errors).

✅ Deadlines are monitored by background job SWWDHEX (scheduled via SWU3); missed deadlines trigger notifications or modelled escalation branches.

⚠️ Administrative actions (complete, forward, restart) change the business process — document them and fix the root cause, otherwise the same error returns.

━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE

Parts 1–4 built and governed workflows. This lesson is the support playbook.

━━━━━━━━━━━━━━━━━━━━
▶ 1. WORKFLOW DID NOT START

  • SWELS: switch on event trace; SWEL: see whether the event was raised and whether a receiver was started or failed (e.g. start condition false, linkage inactive, binding error).
  • SWE2: linkage active? Error handling setting (deactivate on error vs mark as having errors).
  • SWE5 / SWEQADM: event queue for delivery problems.

━━━━━━━━━━━━━━━━━━━━
▶ 2. STEP IN ERROR

  • SWI1 / SWI2_DIAG: work items with status ERROR; the log shows the error message (e.g. method exception, binding).
  • Fix the cause (data, authorization, code), then restart via SWPR or SWIA ("Restart after error").

━━━━━━━━━━━━━━━━━━━━
▶ 3. NO AGENT / WRONG AGENT

  • Log → agents of the step; rule simulation in PFAC.
  • SWIA: forward the work item to the correct user (with documentation), then fix the rule/org data.

━━━━━━━━━━━━━━━━━━━━
▶ 4. DEADLINES AND ESCALATION

  • Step deadlines (latest end) monitored by SWWDHEX (job interval in SWU3).
  • Model escalation: modelled deadline branch (e.g. notify manager, then escalate to next level), or process control step to cancel/restart.

━━━━━━━━━━━━━━━━━━━━
▶ 5. ERROR HANDLING IN CODE

  • Methods raise defined exceptions (temporary vs application errors); temporary errors can be retried automatically (settings on the step).
  • Avoid dumps in methods — use exceptions and messages.

━━━━━━━━━━━━━━━━━━━━
▶ 6. ADMIN TOOLS SUMMARY

SWIA (execute/complete/forward), SWPR (restart errors), SWPC (continue after system crash), SWI5 (work items per agent), SWUD (diagnosis).

━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP

  1. Switch on SWELS and raise an event that doesn't match the start condition; read SWEL.
  2. Force a method exception in a test workflow and restart it via SWPR after fixing.
  3. Set a short deadline and observe the escalation after SWWDHEX runs.

✅ CHECKPOINT: you can analyse workflow errors, restart safely and design escalations.

Code example

ABAP Code
* ===== Support playbook =====* Did not start : SWELS (trace on) -> SWEL (receiver result) -> SWE2 linkage / start condition* Step error    : SWI1 / SWI2_DIAG -> log -> fix cause -> SWPR or SWIA restart* Wrong agent   : log agents, PFAC simulate, SWIA forward (documented), fix rule/org data* Deadlines     : SWU3 -> SWWDHEX job; modelled deadline branch for escalation* Crash         : SWPC continue workflows after system error* Overview      : SWI5 (by agent), SWI2_FREQ, SWUD diagnosis * ===== Restarting a workflow in error via API (e.g. from a support tool) =====REPORT zwf_restart. PARAMETERS p_wiid TYPE sww_wiid OBLIGATORY.        " workflow (top-level) work item ID DATA: lv_rc  TYPE sy-subrc,      lt_msg TYPE STANDARD TABLE OF swr_mstruc,      ls_msg TYPE swr_mstruc. START-OF-SELECTION.  CALL FUNCTION 'SAP_WAPI_ADM_WORKFLOW_RESTART'    EXPORTING      workitem_id = p_wiid      do_commit   = 'X'    IMPORTING      return_code = lv_rc    TABLES      message_struct = lt_msg.   IF lv_rc = 0.    WRITE: / 'Workflow restarted:', p_wiid.  ELSE.    LOOP AT lt_msg INTO ls_msg.      WRITE: / ls_msg-msgty, ls_msg-msgid, ls_msg-msgno, ls_msg-msgv1.    ENDLOOP.  ENDIF.* Only restart after fixing the root cause; document the action.

Real project scenario

Invoice approvals stopped starting after a transport. SWEL showed the event was raised but the receiver "not started — linkage deactivated": a binding error during testing had deactivated the linkage (error handling setting "deactivate linkage").
The team reactivated the linkage, changed the error handling to "mark linkage as having errors" so single errors don't stop all workflows, fixed the binding, and restarted the affected cases. SWELS monitoring was added to the post-transport checklist.

Common mistakes

  • Restarting without fixing the cause.
  • Event trace never switched on during analysis.
  • Linkage error handling set to deactivate.
  • SWWDHEX job not scheduled (no deadlines).
  • Undocumented administrative forwarding/completion.

Best practices

  • Use SWEL for start problems, SWI1/SWI2_DIAG for step errors.
  • Fix root cause, then SWPR/SWIA restart.
  • Error handling on linkages that doesn't block all.
  • Model escalations; schedule SWWDHEX.
  • Document admin actions.

Interview angle

Questions: "A workflow didn't start — how do you analyse?", "How do you restart a workflow in error?", "How do deadlines work?"
Strong answer: SWELS/SWEL event trace, SWE2 linkage and start conditions, SWE5 queue; SWI1/SWI2_DIAG and log for step errors, fix then SWPR/SWIA restart; wrong agents via log, PFAC simulation, SWIA forward; deadlines via SWWDHEX (SWU3) and modelled escalations; document admin actions.

Practice this lesson

Quick check

1. Which transaction shows whether an event was raised and whether a workflow receiver was started?

2. A workflow step is in error. After fixing the cause, how is it continued?

3. Which background job monitors workflow deadlines?

Interview questions

1. A workflow is not starting even though the triggering business event is being raised successfully. Walk through your debugging approach to identify the root cause.

Answer it in your own words first, then compare.

2. How do you implement and handle exceptions/errors within an ABAP Workflow such that the process doesn't get stuck in an error state and business users are notified appropriately?

Answer it in your own words first, then compare.

Practice more with Interview AI →

Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.

More lessons in this topic

Interview questions on this topic

Related SAP topics