Workflow Part 2: Building Templates — Steps, Containers and Binding
Preview · a free account unlocks the full lesson
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 sectionsHide sections
Visual overview
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.
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
Interview questions on this topic
Related SAP topics
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.