SAP technical topicObjectCustom code migration for S/4HANAModuleABAP

Custom Code Migration for S/4HANA

Custom code migration is the project activity that finds, classifies and fixes every Z and Y ABAP object that will break, misbehave, or become obsolete when a system moves to S/4HANA. It runs on ATC results plus usage data, and it is really three separate workstreams - simplification-driven fixes, HANA-specific fixes, and general hygiene - that get mistakenly treated as one backlog.

This page covers how custom code migration is structured, where it sits relative to ATC, the simplification database and usage tracking, and how architects should decide what actually needs fixing before a conversion. It includes a worked example around the extended material number and a pitfalls list drawn from real conversion projects.

Published 16 Sept 2026· 1,425 words

What it is

Custom code migration for S/4HANA is the project workstream that takes every Z and Y object in a customer system - reports, includes, function modules, BAdI implementations, user exits, enhancements - and works out which ones will break, behave differently, or become pointless on the target release, then fixes them before or during the technical conversion. The structural fact that causes most confusion: this is not one activity, it is three overlapping ones running on different clocks. There is remediation forced by simplification items (data model changes such as the extended material number, or table restructuring in inventory management and CO-PA), there is HANA-specific remediation (removed pool and cluster tables, native SQL against structures that no longer exist), and there is general ABAP hygiene that ATC flags but that the platform does not force anyone to fix before go-live. Projects that lump all three into a single backlog and a single deadline consistently blow their estimates.

When to use it

This work is mandatory ahead of any technical conversion from ECC to S/4HANA, and it recurs on every upgrade afterward because SAP continues to retire APIs and tighten simplification rules. It is the right lens whenever the question is 'will this custom object still run correctly after the release change'. It is the wrong lens for deciding whether a piece of custom logic should exist at all - that is an extensibility and clean core question, not a migration question, and answering it purely from ATC output produces a fix-everything backlog that ignores business value. It is also the wrong tool for functional testing: ATC and the migration workstream tell you code will compile and run, not that the business result is still correct after a simplification item changes underlying logic. That verification belongs to functional testing, not to the migration team.

How it fits the stack

Below the migration workstream sits the ATC run itself, driven off the SAP Readiness Check and the simplification item database, plus usage tracking data that shows which objects are actually executed in production rather than merely present in the system. Above it sits the conversion project plan and cutover schedule, which decide when each finding must be closed - before the technical conversion, during the SPDD/SPAU adjustment phase, or parked for post-go-live cleanup. It replaces the older, ad hoc practice of relying on a handful of Note-driven fixes and manual code review at upgrade time. It does not replace SPDD and SPAU, which handle dictionary and program adjustments for objects modified against SAP standard; custom code migration runs alongside that step and often surfaces conflicts between a custom enhancement and a simplified standard object that SPAU alone will not catch.

A worked example

A logistics customer has a custom report that reads material master data directly, builds an internal table keyed on the material number field, and passes that key into several other custom function modules and an interface file layout with a fixed-width output column. On conversion, MATNR's length changes because the extended material number simplification item is active in the target release. ATC flags every place where the field length is hardcoded or where the value is truncated for display or file output. The fix touches three layers: the internal table declarations need to reference the data element rather than a literal length, the interface file format needs a decision on whether the receiving system can accept a longer field or needs a mapping table, and the function modules need regression testing with a real 40-character material number, not just the padded 18-character values used in the original test data. None of this shows up by running the report once in a sandbox with legacy master data - it only surfaces once a genuinely long material number is created and pushed through the full chain.

How to choose

The real decision is not whether to fix a finding, it is what to do with it, and that decision belongs to an architect working with usage data, not to whoever is fastest through the ATC worklist.

  • Retire, replace, or remediate: check usage data first - an object with zero executions in the last relevant period is a retirement candidate, not a remediation ticket, regardless of what ATC flagged
  • Rewrite versus patch in place: if remediation touches the same logic clean core guidance says should move to a released API or a side-by-side extension, do that rewrite now rather than patching the old approach and inheriting the same debt next upgrade
  • Timing: separate findings that block the technical conversion (compile errors, removed objects) from findings that are safe to fix in a follow-up sprint after go-live - conflating the two lengthens the cutover window for no reason
  • Severity versus priority: ATC error-level findings are not automatically higher business risk than a priority-1 performance warning on a report that runs every five minutes; risk ranking needs a business owner in the room, not just the ATC traffic light
  • Testing depth: any fix touching a simplification item needs regression testing at realistic data volume and with realistic field values, not just a compile check - the finding closing in the IDE proves nothing about production behavior

Common pitfalls

Most of the damage in these projects comes from treating the ATC report as the finish line rather than the starting point.

  • ATC comes back clean in the development system but the usage data window used to scope the check was too short, so seasonal or period-end programs never executed and never got flagged, then fail in the first month-end after go-live
  • SPDD and SPAU adjustments get closed without checking whether a custom enhancement attached to the modified object still fires correctly - the standard object compiles, the enhancement silently stops triggering
  • A simplification item fix is applied to satisfy the checklist without regression testing the downstream consumers of that data, so the fix is technically correct and the business result is now wrong
  • Custom code migration is run once before go-live and never again, so clean core drift creeps back in on the next release and the same remediation cost repeats
  • Custom BAdI implementations tied to a BAdI definition that was removed or restructured get flagged as syntax errors but the underlying business requirement gets lost when the implementation is simply deleted to make the error go away
  • Performance-related ATC findings pass on small test datasets and only show their cost once the object runs against production-scale tables on HANA, where the anti-pattern that was tolerable on the old database becomes the dominant runtime cost

ECC, S/4HANA and clean core

In ECC, custom code accumulated with little pressure to keep it aligned with standard, because the underlying data model was stable for years at a time. S/4HANA removes that stability, and clean core guidance treats every conversion as an opportunity to reduce the custom footprint rather than carry it forward unchanged. Direct table access, use of removed structures, and reliance on now-obsolete BAdIs are discouraged going forward, with the expectation that remediated logic moves toward released APIs and supported extension points where one exists. Carrying the same modification-heavy code across a conversion without addressing this is technically possible but stores up the identical remediation cost for the next upgrade cycle.

Whose problem this is

Development executes the remediation. Architecture decides scope, prioritization, and whether a finding is a fix, a rewrite, or a retirement, using usage data as evidence rather than ATC severity alone. Functional owners validate that the business result is still correct after a simplification-driven change. The handover to functional testing should include which objects changed and why, not just a closed ATC worklist.

Related SAP objects

Reviewed pages this object connects to in the ERPClimb knowledge graph.

Source: ERPClimb — https://erpclimb.com/sap-technical-topics/custom-code-migration-for-s-4hanaERPClimb is an independent platform and is not affiliated with SAP SE. Reference pages are written and reviewed by SAP consultants for learning and troubleshooting.