SAP S/4HANA Clean Core and Custom Code Migration Tutorial (Part 1)
Understand Clean Core as an upgrade-stability discipline: keep S/4HANA standard as intact as practical, use released extension contracts, govern exceptions and move decoupled capabilities to side-by-side platforms where appropriate.
What this complete series covers
Learn Clean Core as a practical S/4HANA modernization path: understand extension choices, classify custom code, run ATC/cloudification checks, replace unreleased dependencies and govern exceptions.
- Who it is for
- Best for SAP architects, ABAP developers, technical leads and transformation teams planning S/4HANA custom-code remediation or clean-core governance.
- Prerequisites
- Basic ABAP and S/4HANA architecture knowledge helps. No deep BTP experience is required; the series explains where side-by-side extensions fit.
- Final outcome
- By the end, you should be able to assess a custom-code portfolio, choose remediation outcomes, use ATC evidence, select released extension contracts and define a sustainable clean-core governance model.
- Part 1: SAP S/4HANA Clean Core and Custom Code Migration Tutorial (Part 1)
Understand what Clean Core means, why it matters and what it changes in S/4HANA extension decisions.
- Part 2: SAP S/4HANA Clean Core: On-Stack vs Side-by-Side Extensions (Part 2)
Use a consistent Clean Core decision sequence—standard, key-user extensibility, released on-stack extension, released API or side-by-side BTP—before accepting tightly coupled custo
- Part 3: SAP Custom Code Migration: Triage Custom Objects for Clean Core (Part 3)
Classify custom code by actual usage, business criticality and dependency risk so S/4HANA modernization targets the objects that truly need retirement, remediation, replacement, re
- Part 4: SAP Custom Code Migration: ATC Cloudification and Remediation (Part 4)
Use ATC and cloudification checks to identify and prioritize custom-code remediation for S/4HANA and ABAP Cloud readiness.
- Part 5: SAP Clean Core: Released APIs vs Direct Table Access (Part 5)
Use released business APIs and CDS contracts instead of direct dependencies on SAP internal tables for new clean-core development, especially for updates where direct writes bypass
- Part 6: SAP Clean Core Extensibility: Key User, Developer and Side-by-Side (Part 6)
Choose among key-user, developer and side-by-side extensibility by coupling, lifecycle and complexity, using the least invasive released option that satisfies the business requirement.
- Part 7: SAP Clean Core Risks: Modifications, Enhancements and Unreleased APIs (Part 7)
Identify the highest Clean Core risks by dependency type: direct SAP modifications, implicit source enhancements, unreleased APIs and direct writes to standard tables create more u
- Part 8: SAP BTP Side-by-Side Extension for Clean Core (Part 8)
Choose side-by-side BTP extension when the capability benefits from an independent lifecycle and loose coupling, integrating through released APIs or events rather than recreating
- Part 9: SAP Clean Core Governance: Standards, ATC and Documentation (Part 9)
Sustain Clean Core after go-live with an extension inventory, released-API checks, ATC quality gates, named owners, exception records and periodic review of upgrade-sensitive dependencies.
System and release assumptions: Clean-core tooling, released APIs and extensibility options vary by S/4HANA and ABAP platform release. Validate release status and ATC checks in the target landscape.
Explanation
Clean Core does not mean "no custom code." It means custom extensions should avoid unnecessary modifications and dependencies on internal SAP implementation so the ERP core can be upgraded and evolved with less regression risk.
The preferred approach is to start with standard configuration and fit-to-standard process design, then use supported extensibility in increasing degrees of coupling: key-user extensibility, on-stack developer extensibility with ABAP Cloud and released APIs/BAdIs, or side-by-side BTP extensions when the capability needs an independent lifecycle, technology stack or integration boundary.
The architectural test is dependency quality. A custom class that directly reads an internal SAP table can be more upgrade-sensitive than a larger extension built entirely on released contracts. Likewise, moving code to BTP does not make it clean if it scrapes internal tables through unsupported interfaces.
Governance matters after go-live. ATC, released API checks, extension inventories, owners and exception reviews help prevent the landscape from drifting back toward high-risk custom code.
Clean Core should be applied pragmatically to business value. Not every stable classic extension should be rewritten immediately; prioritize unsupported, heavily coupled and strategically changing areas.
Code example
"Clean-core decision order"1. Standard process/configuration?"2. Key-user extensibility?"3. Released on-stack ABAP Cloud API/BAdI?"4. Side-by-side BTP via released API/event?"5. Governed exception only if no supported option exists. "Quality gate:"ATC + released-object checks + regression testsReal project scenario
A conversion program initially planned to rewrite every Z object. It instead classified custom code by usage and dependency risk. Unused objects were retired, high-risk direct-table dependencies were remediated, while stable low-risk extensions remained until business change justified replacement.
Common mistakes
- Defining Clean Core as zero customization.
- Moving unsupported logic to BTP and calling it clean.
- Rewriting every legacy object regardless of usage.
- Ignoring governance after migration.
- Measuring success only by custom-object count.
Best practices
- Start with standard before extension.
- Prefer released contracts.
- Use ATC and dependency inventories.
- Prioritize high-risk/high-change code.
- Govern exceptions with owner and expiry/review.
Interview angle
Explain Clean Core in terms of upgrade-stable dependencies, released APIs and extensibility options, not as a blanket ban on custom code.
Practice this lesson
Quick check
1. A review finds this recurring pattern around What Clean Core Means and Why: "Comparing counts from different ATC variants." Which principle should the team adopt?
2. Which extensibility option keeps the digital core cleanest?
3. A released API means:
Interview questions
1. A customer wants to modify a standard S/4HANA transaction. How do you keep the core clean?
Answer it in your own words first, then compare.
2. Enhancement broke after upgrade. Clean Core lens?
Answer it in your own words first, then compare.
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
- SAP BTP Side-by-Side Extension for Clean Core (Part 8)
- SAP Clean Core Extensibility: Key User, Developer and Side-by-Side (Part 6)
- SAP Clean Core Governance: Standards, ATC and Documentation (Part 9)
- SAP Clean Core Risks: Modifications, Enhancements and Unreleased APIs (Part 7)
- SAP Clean Core: Released APIs vs Direct Table Access (Part 5)
- SAP Custom Code Migration: ATC Cloudification and Remediation (Part 4)
- SAP Custom Code Migration: Triage Custom Objects for Clean Core (Part 3)
- SAP S/4HANA Clean Core: On-Stack vs Side-by-Side Extensions (Part 2)