ERPClimb logoERPClimb
Workflow
ABAP Developmentintermediate 9 min read

Workflow Part 2: Building Templates — Steps, Containers and Binding

Preview · a free account unlocks the full lesson

Key takeaway

Build a workflow template in SWDD: activity, user decision, condition, multiple condition, fork, loop and wait steps; the workflow container and task containers; data binding between event, workflow, task and method; start conditions; deadlines; and testing with SWUS and the workflow log.

In this lessonShow sections

Visual overview

Workflow Part 2: Building Templates — Steps, Containers and Binding — learning sheetFlow: SWDD: create a template with container element PurchaseOrder (BUS2012) → Add a user decision "Approve PO &PurchaseOrder.PurchaseOrder&" with two outcomes and a condition on the amount before it → Link it to the event in SWE2 with a start condition; test with SWUS and check the log. Key ideas: STEP TYPES; CONTAINERS AND BINDING; START CONDITIONS; DEADLINES. Watch out: Binding errors are the most common build error: a missing binding silently passes empty values — the step "works" but decisions are based on nothing.ERPClimb.com / ABAP / LESSON 2/5 / LEARNING SHEETWorkflow Part 2: Building Templates — Steps, Containersand Binding1 · HOW IT FLOWS1SWDDcreate a template with containerelement PurchaseOrder (BUS2012)2Add a user decision"Approve PO&PurchaseOrder.PurchaseOrder&"…3Link it to the event inSWE2 with a startcondition; test with SWUS…2 · KEY IDEAS EXPLAINEDStep TypesActivity: executes a single-step task (method ofBOR object or IF_WORKFLOW class) — dialog orbackground.User decision: work item with decision options(Approve/Reject); result branches.Containers And BindingWorkflow container elements: e.g. PurchaseOrder(BOR BUS2012 or class reference), Amount,Approver, Decision.Event → workflow binding: _EVT_OBJECT →PurchaseOrder.Start ConditionsSWB_COND (or event linkage): e.g. only if POdocument type = 'NB' and total value > 5,000 —avoids unnecessary instances.DeadlinesRequested/latest start and end per step; misseddeadline → notification or modelled escalationbranch (Part 5).3 · REMEMBER · WATCH OUTRememberStep types: activity (runs a task), user decision (approve/rejectbuttons), condition/multiple condition (branch on data), fork…The workflow container holds instance data; binding maps dataexplicitly between event → workflow, workflow → task, task → method…Start conditions (SWB_COND) on the event linkage make sure theworkflow starts only for relevant cases (e.g. document type, amount).!Watch outBinding errors are the most commonbuild error: a missing bindingsilently passes empty values — thestep "works" but decisionsare based on nothing.4 · IN A REAL PROJECTA PO approval workflow routed every PO to the same fallback approver. The log showed the Amount element wasalways 0: the binding from the "Read PO data" step result to the workflow container had been deletedduring a change, so the condition always took the "small amount" branch — and the approver rule got…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Part 1 explained workflow architecture; this part builds a simple approval template to put that into practice.

A workflow template is assembled from several step types: an activity step runs a task; a user decision step presents approve/reject buttons; a condition or multiple-condition step branches based on data; a fork runs branches in parallel; a loop repeats steps using UNTIL or WHILE logic; a wait-for-event step pauses until something happens; and there are also send-mail and container-operation steps.

The workflow container holds the instance's data, and binding is what explicitly maps that data between the triggering event and the workflow, between the workflow and a task, and between a task and its underlying method, in both directions.

Start conditions, defined through SWB_COND on the event linkage, make sure the workflow only starts for relevant cases — for example, only for a certain document type or above a certain amount.

The most common building mistake is a missing binding: without it, a step still technically "works," but it silently passes empty values, so any decision based on that data is really based on nothing.

Looking at step types in more detail: an activity step executes a single-step task, which wraps a method of a BOR object or an IF_WORKFLOW class, and can run either as a dialog or in the background.

A user decision step creates a work item with named decision options, such as Approve or Reject, and the outcome determines which branch runs next. Condition and multiple-condition steps branch based on container values, for instance checking whether an amount exceeds 10,000.

A fork step runs branches in parallel and can be configured to continue once "n of m" branches complete. A loop step, using UNTIL or WHILE, handles repeating logic such as rework cycles. A wait-for-event step pauses the workflow until a specific event occurs, like a document being changed.

Beyond these there are also steps for sending mail, manipulating the container directly, and process control steps that can cancel work items.

Free account

Create a free account to keep reading

You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.

  • Full explanation
  • Code example
  • Real project scenario
  • Common mistakes
  • Best practices
  • Interview angle

One tap with Google works too. Every topic keeps its first lesson open to everyone.

Keep exploring

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.