Guide · SAP S/4HANA custom code

How do we clean up custom ABAP code before an S/4HANA conversion?

Start with usage, not with the code. Collect usage data in production with SAP's ABAP call monitor (SCMON) and its aggregation (SUSG), then retire what nobody runs. Check what remains with SAP's S/4HANA readiness checks, through the ABAP Test Cockpit, the Custom Code Migration app or SAP's custom code migration agent, and give each object one disposition: retire, replace with standard, adapt for the conversion, or rebuild as a clean-core extension. Lab0, your AI implementation partner for SAP S/4HANA, assesses the ECC estate from the documents and exports your team supplies, then reads and changes ABAP on the S/4HANA target under your team's control.

Updated 3 December 2026 · Written by Lab0

Start with usage data, not with the code

Most ECC systems carry custom code that nobody runs any more. SAP's conversion guide recommends a consolidated view of the custom code used in production, and removing the code that is no longer used. Retiring an object is less work than fixing it, testing it and carrying it through every later upgrade.

  • Collect usage data early. Switch on SAP's ABAP call monitor (transaction SCMON) in production and keep the results as aggregated usage data (transaction SUSG). SAP recommends at least a year of data, so period-end and year-end runs are included.
  • List everything custom. Programs, function modules, classes, enhancements, modifications of SAP objects, custom tables, forms and interfaces, each with its owner and business purpose.
  • Check what remains. Run SAP's S/4HANA readiness checks on the code that is still used, to see which objects conflict with S/4HANA simplifications.
  • Convert a test copy first. SAP recommends converting a development or test system before production, so the team can adapt code and collect the fixes in transports.

Give every object one disposition

Each custom object gets exactly one of four dispositions, decided with the evidence for it. The first two shrink the work; the last two are the work.

DispositionChoose it whenEvidenceWho decides
RetireUsage data shows nobody ran the object in at least a year, including year-end.Usage data from production, and the owner's confirmationProcess owner, with IT
Replace with standardS/4HANA now covers the need in standard, for example with a Fiori app, a new business process or standard output.The standard feature mapped to the requirement the code metProcess owner
Adapt for the conversionThe code is still used and must work on the first day, but it conflicts with an S/4HANA simplification.Findings from SAP's S/4HANA readiness checks, and the simplification items behind themDevelopment lead
Rebuild as a clean-core extensionThe business still needs the logic, and standard S/4HANA does not cover it.The requirement, and whether released APIs (level A) or classic APIs (level B) can support itSolution architect

Record each decision with its owner and the evidence behind it, and trace every object you keep or rebuild to the requirement it serves. Code adapted for the conversion can be rebuilt as a clean-core extension after go-live.

SAP's own tools for custom code, before and after the conversion

SAP's tools find the code that breaks and the code nobody uses. These are the main ones, from SAP's Conversion Guide for SAP S/4HANA 2025, its custom code documentation and its Business AI release highlights.

SAP toolWhat it tells youWhen
SAP Readiness Check for SAP S/4HANAA planning view of the simplification items, add-ons and custom code the conversion affectsEarly, to scope the program
ABAP call monitor (SCMON) and aggregated usage data (SUSG)Which custom objects production actually runs, collected over monthsAs early as possible, in production
Custom Code Migration appCustom code findings against SAP's S/4HANA simplifications, with unused code scoped out by usage dataBefore the conversion
ABAP Test Cockpit (ATC), check variant S4HANA_READINESSThe findings to fix in code that staysBefore the conversion, and again in the converted system
Simplification Item CheckThe simplification items that apply to your system; the Software Update Manager runs it again during the conversionPrepare phase
SPDD, SPAU and SPAU_ENHAdjustment of your modifications: dictionary objects in SPDD during the conversion, other objects and enhancements in SPAU and SPAU_ENH after itDuring and after the conversion
ABAP development tools for EclipseSAP's recommended editor for adapting code, because SE80 does not support all the objects S/4HANA needs, such as CDS viewsAdaptation and rebuild
SAP S/4HANA custom code migration agent (Joule for Developers, ABAP AI)Runs the S/4HANA readiness checks across custom code packages, applies the fixes it is confident about in transport requests, and leaves lower-confidence proposals as comments for developers. SAP lists it as generally available in its Business AI highlights for the second quarter of 2026.Adaptation of the code you keep

SAP's custom code guide adds that static checks cannot find every issue, for example in dynamic code, so test custom code in the converted system as well. The simplification database the checks use is downloaded as described in SAP Note 2241080. SAP also lists a Custom Code Assistant among its migration and modernization assistants for moves to SAP Cloud ERP Private. In October 2026, SAP said it was available to early adopter customers.

Where rebuilt code should land: SAP's clean core levels

Since August 2025, SAP rates extensions on four clean core levels instead of the earlier three tiers. On S/4HANA on-premise and private cloud, ABAP Cloud is the recommended way to reach level A, and classic extensibility is still available.

LevelWhat the code usesWhat it means at upgrade
Level AOnly released APIs: ABAP Cloud on the S/4HANA stack, or side-by-side on SAP BTPUpgrade-stable under SAP's stability contract; SAP's target
Level BClassic APIs that SAP documents and classifies as upgrade-stable, such as BAPIsGenerally upgrade-stable
Level CSAP internal objects that are not releasedCan change in an upgrade, so list them and test them each time
Level DTechniques SAP does not recommend: modifications, direct writes to SAP tables, implicit enhancementsThe highest upgrade risk; plan to remove them

The level matters at every upgrade. SAP ships a new S/4HANA release for on-premise and private cloud every two years, with feature package stacks about every six months, and each release gets seven years of mainstream maintenance. S/4HANA Cloud Private Edition, which SAP now also calls SAP Cloud ERP Private, runs the same releases as on-premise. Code at levels A and B is the least work at each upgrade; code at levels C and D needs checks and tests every time. For when your release leaves mainstream maintenance and SAP's upgrade tools, see S/4HANA release upgrades. On S/4HANA Cloud Public Edition, extensions follow SAP's key user, side-by-side and developer options instead: see how an S/4HANA Cloud Public Edition implementation works.

What you receive from Lab0

  • Discovery with cited answers. Lab0's agent drafts questions from your custom code inventory, specifications and other documents, and interviews each process owner by a private web link, with voice. Every drafted answer cites the document, interview or transcript it came from. Answers that contradict each other are flagged with both quotes, and a person accepts every answer.
  • A requirements register. Accepted answers become a locked register with a source for each requirement, exportable as CSV or JSON, so the reason for keeping or rebuilding each object is on record with its source. Stakeholders sign off by email link.
  • The document pack. About 25 delivery documents drafted from the locked requirements, including the high-level and low-level design, test plan and cases, traceability matrix, RAID log and cutover plan.
  • ABAP reads and governed ABAP changes. On the S/4HANA target, on-premise or private cloud, Lab0 reads your ABAP. Once a person grants write access for the chat, it makes governed ABAP changes: a dry run first, activation, and a transport your basis team controls, read back where the platform allows.
  • A readiness report. A read-only readiness report on your S/4HANA system, published as a PDF.

Lab0 assesses the ECC estate from the documents and exports your team supplies, and works directly on the S/4HANA side. SAP's own code checks, ATC and ABAP Unit, still run in your SAP system. Lab0's consultants and engineers lead the work, and its agents do the reading and drafting under them. A consultant approves every agent output before you see it, and changes go to a test system first. Lab0 has worked with five Fortune 500 companies, many of its customers are in the Middle East, and it is backed by Y Combinator.

For the whole move from ECC, see how to speed up an ECC to S/4HANA migration. After go-live, see how to run S/4HANA after go-live. For Lab0's wider SAP work, see Lab0 for SAP.

More SAP S/4HANA implementation guides

FAQ

Common questions

How do we find unused custom code before an S/4HANA conversion?
Collect usage data in your production ECC system with SAP's ABAP call monitor (transaction SCMON), and keep it as aggregated usage data (transaction SUSG) for at least a year, as SAP recommends, so period-end and year-end runs are included. Custom objects nobody ran in that time are candidates to retire. SAP's Custom Code Migration app can use the same usage data to leave unused code out of the analysis.
Can SAP's AI fix our custom ABAP code for an S/4HANA conversion?
Partly. SAP's S/4HANA custom code migration agent, part of Joule for Developers, is generally available according to SAP's Business AI highlights for the second quarter of 2026. It runs the S/4HANA readiness checks of the ABAP Test Cockpit (check variant S4HANA_READINESS) across custom code packages, applies the fixes it is confident about in transport requests and leaves the rest as comments for developers. Your team still decides which objects to retire, replace or rebuild, and tests the result.
What is clean core in SAP S/4HANA?
Clean core means extending S/4HANA without changing SAP's own code, so upgrades stay predictable. Since August 2025, SAP rates extensions on four levels: A uses only released APIs, B adds classic APIs that SAP documents as upgrade-stable, C uses SAP internal objects, and D uses techniques SAP does not recommend, such as modifications or direct writes to SAP tables. Aim new code at level A or B.
Should we rewrite all custom code as clean-core extensions before converting to S/4HANA?
Usually not. A conversion needs the code that stays to work on the first day, so retire what nobody uses and adapt the rest for S/4HANA's simplifications. Rebuild code as clean-core extensions where the business still needs the logic and standard S/4HANA does not cover it, and schedule the remaining rebuilds after go-live, ideally before your next upgrade.
What does Lab0 do on custom code for an S/4HANA conversion?
Lab0 is an AI implementation partner for SAP S/4HANA. It assesses the ECC estate from the documents and exports your team supplies, records each decision with its source in a requirements register your owners sign off, and drafts the design, test and cutover documents. On the converted S/4HANA system, on-premise or private cloud, Lab0 reads ABAP and makes governed ABAP changes once a person grants write access. SAP's own code checks still run in your SAP system.

Bring your custom code inventory.

Tell us how much custom code you carry and when you plan to convert. We'll show you how Lab0 would run the clean-up with your team.