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.
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.
| Disposition | Choose it when | Evidence | Who decides |
|---|---|---|---|
| Retire | Usage data shows nobody ran the object in at least a year, including year-end. | Usage data from production, and the owner's confirmation | Process owner, with IT |
| Replace with standard | S/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 met | Process owner |
| Adapt for the conversion | The 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 them | Development lead |
| Rebuild as a clean-core extension | The 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 it | Solution 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 tool | What it tells you | When |
|---|---|---|
| SAP Readiness Check for SAP S/4HANA | A planning view of the simplification items, add-ons and custom code the conversion affects | Early, to scope the program |
| ABAP call monitor (SCMON) and aggregated usage data (SUSG) | Which custom objects production actually runs, collected over months | As early as possible, in production |
| Custom Code Migration app | Custom code findings against SAP's S/4HANA simplifications, with unused code scoped out by usage data | Before the conversion |
| ABAP Test Cockpit (ATC), check variant S4HANA_READINESS | The findings to fix in code that stays | Before the conversion, and again in the converted system |
| Simplification Item Check | The simplification items that apply to your system; the Software Update Manager runs it again during the conversion | Prepare phase |
| SPDD, SPAU and SPAU_ENH | Adjustment of your modifications: dictionary objects in SPDD during the conversion, other objects and enhancements in SPAU and SPAU_ENH after it | During and after the conversion |
| ABAP development tools for Eclipse | SAP's recommended editor for adapting code, because SE80 does not support all the objects S/4HANA needs, such as CDS views | Adaptation 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.
| Level | What the code uses | What it means at upgrade |
|---|---|---|
| Level A | Only released APIs: ABAP Cloud on the S/4HANA stack, or side-by-side on SAP BTP | Upgrade-stable under SAP's stability contract; SAP's target |
| Level B | Classic APIs that SAP documents and classifies as upgrade-stable, such as BAPIs | Generally upgrade-stable |
| Level C | SAP internal objects that are not released | Can change in an upgrade, so list them and test them each time |
| Level D | Techniques SAP does not recommend: modifications, direct writes to SAP tables, implicit enhancements | The 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
- What to decide first in S/4HANA Finance: Universal Journal, ledgers and business partner
- How to implement S/4HANA Sourcing and Procurement
- Order to cash in S/4HANA: sales, billing and credit management
- S/4HANA Manufacturing: production planning, MRP and the shop floor
- Extended Warehouse Management: embedded or decentralized
- RISE with SAP or GROW with SAP: which route to S/4HANA fits you?
- S/4HANA release upgrades: 2023 or 2025?