Workflow
ABAP Developmentadvanced

Workflow Part 4: Workflow at Scale — Governance, Flexible Workflow and Clean Core

Key takeaway

Run workflows at enterprise scale: design standards, versioning of templates, transport and migration of running instances, monitoring and administration roles, Flexible Workflow scenarios in S/4HANA (Manage Workflows apps, BAdIs for conditions/agents), and when to use SAP Build Process Automation for clean core and cross-system processes.

Explanation

📌 KEY POINTS
✅ Workflow templates are versioned: running instances keep the version they started with; new instances use the active version — plan changes and migrations accordingly.

✅ In S/4HANA, many approvals are delivered as Flexible Workflow scenarios (e.g. purchase requisition, purchase order, supplier invoice) configured in the "Manage Workflows" Fiori apps with pre-conditions and agent rules (extensible by BAdIs).

✅ Governance: naming and design standards, central agent rules, workflow administrator role, monitoring (SWI2_FREQ, SWI2_DURA, SWIA), archiving of completed workflows.

⚠️ Custom classic templates that duplicate pre-delivered Flexible Workflow scope increase upgrade effort and move away from clean core.

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

Parts 1–3 built a workflow. In large organisations, dozens of workflows run thousands of instances — governance becomes the main challenge.

━━━━━━━━━━━━━━━━━━━━
▶ 1. DESIGN STANDARDS

  • Templates only orchestrate; logic sits in classes (IF_WORKFLOW) or BOR methods.
  • Central, reusable agent rules; consistent naming for tasks, rules and containers.
  • Documentation per workflow: trigger, start conditions, agents, deadlines, escalation.

━━━━━━━━━━━━━━━━━━━━
▶ 2. VERSIONING AND CHANGES

  • Activating a changed template creates a new version; running instances continue with their old version.
  • Plan for old instances: let them finish, or cancel and restart with care (business impact).
  • Transports: templates, tasks, rules, event linkages (activated per system!), org assignments (often maintained per system).

━━━━━━━━━━━━━━━━━━━━
▶ 3. ADMINISTRATION AND MONITORING

  • Workflow administrator (SWU3 settings) receives errors.
  • SWI2_FREQ (frequency), SWI2_DURA (duration), SWIA (admin actions), SWPR (restart after error), SWI1.
  • Archiving completed workflows (object WORKITEM) to keep tables small.

━━━━━━━━━━━━━━━━━━━━
▶ 4. FLEXIBLE WORKFLOW (S/4HANA)

  • Scenario delivered by SAP; business users configure steps, conditions and recipients in Fiori ("Manage Workflows for …").
  • Extension via BAdIs for custom conditions and agent determination.
  • Prefer this over custom templates where available.

━━━━━━━━━━━━━━━━━━━━
▶ 5. BEYOND THE ABAP STACK

  • SAP Build Process Automation (BTP) for cross-system, side-by-side and citizen-developer processes; integrates with S/4HANA via APIs/events.
  • Clean core: extend via released APIs and BAdIs, avoid modifying standard workflows.

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

  1. List your custom workflows and check for Flexible Workflow alternatives.
  2. Review SWI2_FREQ to see which workflows run most.
  3. Define a versioning/transport checklist including event linkage activation.

✅ CHECKPOINT: you can govern workflows at scale and choose between classic, flexible and BTP-based workflows.

Code example

ABAP Code
* ===== Governance checklist (per workflow) =====* Trigger       : object/event (e.g. BUS2105 RELEASESTEPCREATED) + start conditions* Template      : WS9xxxxxxx, owner, version history* Tasks/Rules   : TS..., AC... (shared rules library)* Agents        : org model/rule, excluded agents, substitutes* Deadlines     : escalation path* Admin         : workflow administrator, error notification* Monitoring    : SWI2_FREQ, SWI2_DURA, SWIA, SWI1* Archiving     : WORKITEM archiving object, retention* S/4 alternative: Flexible Workflow scenario available? (Manage Workflows app) * ===== Report: count open work items per task (read-only monitoring helper) =====REPORT zwf_open_items. TYPES: BEGIN OF ty_cnt,         wi_rh_task TYPE swwwihead-wi_rh_task,         cnt        TYPE i,       END OF ty_cnt. DATA: lt_cnt TYPE STANDARD TABLE OF ty_cnt,      ls_cnt TYPE ty_cnt. START-OF-SELECTION.  SELECT wi_rh_task COUNT( * ) FROM swwwihead    INTO TABLE lt_cnt    WHERE wi_type = 'W'                          " dialog work items      AND wi_stat IN ('READY','STARTED','SELECTED')    GROUP BY wi_rh_task.   SORT lt_cnt BY cnt DESCENDING.  LOOP AT lt_cnt INTO ls_cnt.    WRITE: / ls_cnt-wi_rh_task, ls_cnt-cnt.  ENDLOOP.

Real project scenario

During an S/4HANA conversion, a company planned to migrate 35 custom approval workflows. Analysis showed 14 were covered by Flexible Workflow scenarios for purchase requisitions, POs and supplier invoices, configurable by business process owners.
The remaining custom workflows were cleaned up: shared agent rules, logic moved to classes, and a transport checklist including event linkage activation. Open work items were monitored weekly, and completed workflows archived yearly.

Common mistakes

  • Custom templates duplicating Flexible Workflow scope.
  • Ignoring running instances when changing templates.
  • Event linkages not activated after transport.
  • No workflow administrator or monitoring.
  • Never archiving work items.

Best practices

  • Check Flexible Workflow first in S/4HANA.
  • Logic in classes, flow in templates.
  • Version and transport checklist.
  • Regular monitoring and archiving.
  • BTP Process Automation for cross-system processes.

Interview angle

Questions: "How do you govern many workflows?", "What happens to running instances after a template change?", "Flexible Workflow vs classic workflow?"
Strong answer: design standards (logic in classes, shared rules), versioning (running instances keep old version), transport incl. event linkage activation, admin/monitoring SWI2_FREQ/SWI2_DURA/SWIA, archiving; Flexible Workflow scenarios configured in Manage Workflows apps with BAdIs; SAP Build Process Automation for side-by-side; clean core.

Practice this lesson

Quick check

1. In S/4HANA, what should be checked before building a custom approval workflow for purchase requisitions?

2. What happens to running workflow instances when a template is changed and a new version activated?

3. Which is a good governance rule for classic workflows at scale?

Interview questions

1. In S/4HANA, how does Flexible Workflow differ from classic SAP Business Workflow, and what are the key considerations when deciding which approach to use for a new approval process?

Answer it in your own words first, then compare.

2. A retail group running ECC for fifteen years has over 300 custom workflow templates before its S/4HANA move. How do you rationalise them?

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