Enhancements
ABAP Developmentadvanced

Enhancements Part 8: Switch-Controlled Enhancements (Switch Framework)

Key takeaway

Understand how the Switch Framework controls enhancements: business functions, switches and packages (SFW1/SFW2/SFW5), why industry solutions and enterprise extensions are switched, what happens when you activate a business function, and how to use switches for your own enhancements.

Explanation

📌 KEY POINTS
✅ The Switch Framework activates repository objects (including enhancement implementations) only when their switch is on.

✅ Objects are assigned to a package, the package to a switch, switches to business functions; SFW5 activates business functions.

✅ SAP uses it for industry solutions and enhancement packages (EHPs) — the code is installed but inactive until switched on.

⚠️ Activating an SAP business function is usually irreversible — test in a sandbox and check SAP documentation first.

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

Parts 2–7 showed implementations that are always active. Switches add a way to control whole sets of enhancements.

━━━━━━━━━━━━━━━━━━━━
▶ 1. OBJECTS

  • Switch (SFW1) — on/off, assigned to packages, screens, customizing.
  • Business function (SFW2) — groups switches with a business meaning.
  • Business function set — for industry solutions.
  • SFW5 — switch framework customizing: activate business functions (and see which are active).

━━━━━━━━━━━━━━━━━━━━
▶ 2. HOW IT WORKS

An enhancement implementation stored in a package assigned to a switch is active only if the switch is on. SAP's enhancement package code (e.g. new fields and screens) ships with every system but becomes visible only after the business function is switched on.

━━━━━━━━━━━━━━━━━━━━
▶ 3. WHAT HAPPENS ON ACTIVATION

  • Switched objects become active; database changes (new fields) may be applied; customizing and screens appear.
  • Many SAP business functions are not reversible. Reversible ones are marked in SFW5.
  • Activation requires a transport or is done per system according to landscape rules.

━━━━━━━━━━━━━━━━━━━━
▶ 4. CUSTOMER USE

  • You can create your own switches and business functions for your own enhancement implementations — for example to deliver a feature to several companies in one client-independent system and activate it per system.
  • In practice, most customers use simpler controls: a customizing table with a feature flag checked at the start of the enhancement, or BAdI filters.

━━━━━━━━━━━━━━━━━━━━
▶ 5. SUPPORT RELEVANCE

When debugging "missing" logic, check if the enhancement implementation belongs to a switched package and whether the switch is on (SE20 shows the switch; SFW5 shows the state).

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

  1. SFW5: browse active business functions in your system (display only).
  2. SE20: open a SAP enhancement implementation and check its package and switch.
  3. For your own feature, implement a feature flag in a Z customizing table (code example).

✅ CHECKPOINT: you understand how switches control enhancements and how to control your own features safely.

Code example

ABAP Code
* ===== Customer feature flag (simple alternative to own switches) =====* Z table ZFEATURE_FLAGS: MANDT, FEATURE (CHAR30), BUKRS, ACTIVE (FLAG) CLASS zcl_feature DEFINITION PUBLIC FINAL CREATE PUBLIC.  PUBLIC SECTION.    CLASS-METHODS is_active      IMPORTING iv_feature TYPE char30                iv_bukrs   TYPE bukrs OPTIONAL      RETURNING VALUE(rv_active) TYPE abap_bool.ENDCLASS. CLASS zcl_feature IMPLEMENTATION.  METHOD is_active.    DATA lv_flag TYPE flag.    SELECT SINGLE active FROM zfeature_flags INTO lv_flag      WHERE feature = iv_feature AND bukrs = iv_bukrs.    IF sy-subrc <> 0.      SELECT SINGLE active FROM zfeature_flags INTO lv_flag   " global entry        WHERE feature = iv_feature AND bukrs = space.    ENDIF.    rv_active = boolc( lv_flag = 'X' ).  ENDMETHOD.ENDCLASS. * ===== Enhancement implementation guarded by the flag =====ENHANCEMENT 1 zei_new_credit_check.        "active version  IF zcl_feature=>is_active( iv_feature = 'NEW_CREDIT_CHECK' iv_bukrs = vbak-bukrs_vf ) = abap_true.    zcl_credit_check=>check_order( vbak ).  ENDIF.ENDENHANCEMENT. * ===== Switch Framework view (display only) =====* SFW1  switch ZSW_NEW_CREDIT_CHECK -> package ZNEW_CREDIT* SFW2  business function ZBF_NEW_CREDIT (switch above)* SFW5  activate business function (check reversibility first!)* SE20  shows the switch of an enhancement implementation

Real project scenario

A support team spent a day searching why a standard field for foreign trade was not visible in a new system. The screen enhancement came from an SAP enhancement package business function, which was active in the old system but not in the new one.
SFW5 comparison between systems revealed the difference. After checking SAP documentation for irreversibility and side effects, the basis team activated the business function in the sandbox first, then via the normal landscape.

Common mistakes

  • Activating SAP business functions without checking irreversibility.
  • Different business function states across the landscape.
  • Searching for missing logic without checking switches.
  • Building complex own switch setups where a feature flag suffices.
  • Feature flags read with SELECT on every loop pass (buffer them).

Best practices

  • Keep SFW5 states identical across the landscape.
  • Check SAP documentation and test in a sandbox before activation.
  • Use simple, buffered feature flags for customer rollouts.
  • Document which enhancements depend on which switch or flag.
  • Check switch state during root-cause analysis.

Interview angle

Questions: "What is the Switch Framework?", "What is SFW5 used for?", "Can business functions be deactivated?"
Strong answer: switches (SFW1) control packages/objects, business functions (SFW2) group switches, SFW5 activates them; switched enhancement implementations are active only when the switch is on; used for EHPs and industry solutions; many activations are irreversible; customers often use feature flags or BAdI filters instead.

Practice this lesson

Quick check

1. A rule must be activated per sales organization in waves. Which control is most practical?

2. Which transaction is used to activate business functions of the Switch Framework?

3. What must you check before activating an SAP business function in SFW5?

Interview questions

1. A CMOD enhancement produces different results in TEST environment versus PRODUCTION. Both use same code version. What could cause this issue? Describe your complete diagnostic approach.

Answer it in your own words first, then compare.

2. A new delivery-block rule must be rolled out sales organization by sales organization over several months. How would you control activation of the enhancement?

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