Last Updated: November 8, 2026
Quick Summary
To identify unused SAP custom code, activate SCMON in your productive system to record actual object executions, let it run for at least one full business cycle, then read the results in SUSG. Validate every zero-execution candidate with where-used analysis and owner confirmation before classifying it as dead.
- Activate SCMON in production, not QA, since test systems have different usage patterns.
- Run the observation window for at least one full business cycle, typically a quarter.
- Run where-used analysis on every candidate, because zero executions with callers is not dead.
- Deactivation is reversible and proves an object is truly unused before permanent removal.
- Retire in small batches and keep a rollback copy of every object you remove.
Table of Contents
- What Counts as Unused SAP Custom Code
- Why Identifying Unused Code Matters Before S/4HANA
- SAP Custom Code Analysis Tools You Can Use
- Step-by-Step: How to Identify Unused SAP Custom Code
- Reading ABAP Code Usage Statistics Without Fooling Yourself
- Dependency and Business-Criticality Checks Before You Delete
- SAP Custom Code Retirement Best Practices for a Safe Cleanup
- How Cleanup Feeds SAP Custom Code Migration to S/4HANA
- Frequently Asked Questions
What Counts as Unused SAP Custom Code
Unused SAP custom code is any custom object in your ECC or S/4HANA system that has no recorded execution over a defined monitoring window.
The tricky part is what “no recorded execution” actually means. A report may run once a quarter for a statutory filing.
Treat “unused” as a hypothesis to test, not a fact to act on.
Three categories usually emerge from any custom code inventory:
- Genuinely dead: no execution, no dependency, no owner who can explain it
- Seasonal or periodic: real but infrequent use tied to a business cycle
- Orphaned but critical: no visible use, yet something downstream depends on it
Only the first category is safe to retire. The other two need evidence before anyone touches them.
Why Identifying Unused Code Matters Before S/4HANA
Every line of custom code you carry into S/4HANA is a line someone has to remediate, test, and maintain. SAP’s own Custom Code Migration Guide for SAP S/4HANA 2025 frames the work around usage data for exactly this reason: you cannot scope remediation on code you have not measured.
Retiring dead code shrinks the migration scope. One contributor in the SAP Community discussion on retiring custom code reported working through close to a tenth of their custom code this way, with the effort still ongoing.
There is a second reason. Custom code that nobody uses still consumes system resources, complicates upgrades, and confuses new developers. Cleanup is not just a migration task. It is housekeeping you should have done years ago.
For the wider planning picture, our SAP S/4HANA migration strategy guide covers how cleanup fits the overall move.
SAP Custom Code Analysis Tools You Can Use
SAP gives you several tools, and they do different jobs. Picking the wrong one wastes weeks.
SCMON and SUSG: Collecting and Aggregating Usage Data
SCMON is the ABAP code usage monitor. It records which custom objects actually execute in your productive system. Turn it on, let it run, and it logs program executions, transaction calls, and related activity.
SUSG aggregates that data into a usable view. SAP Learning lists Usage and Procedure Logging as another option for collecting extension usage data, and an SAP Community answer on unused ABAP code notes that no standard facility simply hands you a list of unused code.
That is the key point most guides skip. There is no magic transaction that outputs “dead code here.” You collect evidence over time.
The Custom Code Migration App and Where-Used Checks
The Custom Code Migration app in SAP Solution Manager and the ABAP Test Cockpit world does the S/4HANA readiness and compatibility checks.
Where-used analysis answers a different question: what references this object? Run it before any deletion.
For a broader view of how these tools sit alongside the rest of your migration toolchain, see our comparison of SAP S/4HANA migration tools.
Step-by-Step: How to Identify Unused SAP Custom Code
The workflow below covers prerequisites, data collection, analysis, and validation. It applies to ECC today and carries into S/4HANA.

Prerequisites and Roles
Before you switch anything on, confirm four things:
- System access. You need authorization to activate SCMON in the productive system, read the collector tables, and run SUSG. In many landscapes this means a basis administrator plus a developer key for the analysis transactions.
- A named owner per package. Someone must be accountable for each custom package before classification starts. Without owners, every candidate becomes a debate.
- A change path for retirement. Confirm how objects will be deactivated or deleted and transported, including your rollback copy.
Step 1: Build Your Custom Code Inventory
Pull the full object list first. Use transaction SE80, table TADIR filtered to your Z namespace, or the Custom Code Migration app’s object scope report. Capture program name, object type, package, transport history, and last change date.
- Filter out SAP standard objects
- Group by package so ownership is clear
- Flag objects with no transport in five years as low-activity candidates
Record the object type for every entry, because monitoring coverage differs by type. Reports and transactions are usually captured well; classes, function modules, enhancements, and indirectly invoked code are captured less reliably.
Step 2: Turn On Usage Monitoring in the Productive System
Activate SCMON in the production system, not QA. Test systems have different usage patterns and will mislead you. Confirm the collector is running, check that data is landing in the collector tables, and leave it alone.
Watch out: monitoring only captures what runs after activation. Anything executed before you switched it on is invisible, so the first days of data are not evidence of absence.
Step 3: Set an Observation Period and Read the Results
Run the observation for at least one full business cycle. For most manufacturers that means a quarter, so month-end, quarter-end, and annual processes all get captured. Retail and public sector clients often need longer to catch seasonal peaks.
Then read SUSG output against your inventory. Sort by execution count and last execution date. Anything with zero executions across the full window becomes a deletion candidate, not a deletion.
Step 4: Validate Candidates Before Classification
Validation is the step most teams skip. For every zero-execution candidate, run where-used analysis, check for dynamic references and RFC destinations, and confirm whether scheduled job variants call it. Cross-check the object type against the monitoring blind spots you noted in Step 1.
Then ask the package owner one question: “Can you explain what this does and when it last ran?” If nobody can, that is stronger evidence than the monitor alone.
| Step | What You Do | Typical Duration | Output |
|---|---|---|---|
| 1 | Build custom code inventory | 1-2 weeks | Full object list with owners and object types |
| 2 | Activate SCMON in production | 1 day | Live usage collection |
| 3 | Observe and read results | 1 full quarter | Candidates ranked by usage |
| 4 | Validate candidates | 1-2 weeks per batch | Classified objects with evidence |
Reading ABAP Code Usage Statistics Without Fooling Yourself
ABAP code usage statistics are evidence, not verdicts. A zero in the execution column means “we did not observe this running,” which is not the same as “this never runs.” The hard part is deciding how much evidence is enough and what to do when the data is incomplete.
Choosing an Observation Period
There is no universal window. Choose one that covers every recurring business cycle the object could serve:
- Monthly close processes need at least a full month, and realistically a quarter so quarter-end logic is captured.
- Annual statutory filings, audits, and year-end runs need a window that includes the event. If the event falls outside your window, the data proves nothing about that object.
- Seasonal workloads such as retail peaks or public-sector fiscal cycles need a window long enough to include the peak.
A common pattern is to run the primary window for one full business cycle, then extend it for any package whose owner flags an annual or seasonal dependency. Document the chosen window and the reason, because that record is what makes the classification defensible later.
Interpreting Incomplete Usage Data
Even a well-chosen window produces incomplete data. Treat these as known limits rather than surprises:
- Background jobs and interfaces. Scheduled jobs may bypass the monitor or run under a system user you filtered out. Check job schedules and RFC destinations directly.
- Dynamic calls. Code invoked dynamically can escape static tracking entirely. Where-used analysis will not always surface these either.
- Rare events. Year-end, audit, or disaster-recovery paths may not trigger during your window.
When data is incomplete, the correct conclusion is “insufficient evidence,” not “unused.” Those candidates belong in the deactivate-and-monitor category, not the delete category.
Turning Evidence into a Decision
Ask the owner of each candidate package one question: “Can you explain what this does and when it last ran?” If nobody can, that is stronger evidence than the monitor alone. Combine three signals before classifying: observed execution, dependency checks, and owner confirmation.
Record the evidence for each decision so the next review cycle can build on it rather than repeat it.
Dependency and Business-Criticality Checks Before You Delete
Never delete on usage data alone. Run where-used analysis on every candidate, then check for dynamic references, RFC destinations, and scheduled job variants that call it.
Then apply a simple decision framework:
- Retain: used, or has dependents, or supports a statutory process
- Deactivate: no observed use but unclear dependencies, so switch it off and monitor
- Archive: no use but retained for audit or documentation reasons
Deactivation is the underrated option. It is reversible, it proves the object is truly unused, and it gives you a safety net before permanent removal.
If you need help framing the risk trade-offs to executives, our guide on explaining technical debt to business leaders translates code risk into business outcomes.
SAP Custom Code Retirement Best Practices for a Safe Cleanup
Safe cleanup follows a few rules that experienced teams learn the hard way.
- Define retention criteria before you classify anything, not after
- Get written sign-off from the business owner for every deletion
- Retire in batches and transport through your normal change path
A common mistake is a big-bang deletion at the end of the project. Retire in small batches, test after each one, and you will catch a missed dependency while it is still cheap to fix.
Our SAP project quality assurance checklist covers the go-live readiness checks that should sit around this work.
How Cleanup Feeds SAP Custom Code Migration to S/4HANA
Cleanup and migration are one project, not two.
The sequence that works: inventory, monitor, classify, retire, then run the Custom Code Migration app on what remains.
For the detailed modernization steps after cleanup, our 7-step guide to modernizing SAP custom code walks through the remediation work itself.
The challenge is not the tools. It is the discipline to monitor for a full cycle, check dependencies, and retire in small batches with sign-off.
Frequently Asked Questions
How can you identify unused custom code in SAP?
Collect usage evidence rather than guessing. Build an object list of your custom programs, reports and Z transactions, then switch on usage monitoring in the productive system using SCMON, with SUSG to aggregate the results. The Custom Code Migration app can also flag unused custom code from collected usage data. Treat the output as candidates for review, not proof: SAP Community cleanup guidance says to define which objects to retain and which are deletion candidates before acting.
How long should SAP custom code usage be monitored before it is retired?
Cover at least one full business cycle, including year-end close, quarterly reporting and any seasonal peaks your plants or supply chain run through. A program that runs once a quarter looks unused in a four-week window. Extend the window for anything touching finance close or regulatory reporting. If the observation period cannot cover a known annual event, mark the object as unproven rather than unused and keep it in the retain pile.
How do you validate that an unused SAP program is safe to remove?
Run a where-used analysis to catch hidden dependencies such as scheduled jobs, interfaces, RFC calls, enhancements and other custom objects that reference the program. Confirm with the business owner that no manual or periodic process relies on it. Then deactivate or comment out the code and monitor the system through another full cycle before deleting. SAP Community guidance supports this scoped review approach rather than deleting purely because an object shows no recorded usage.
Which SAP tools can help analyze custom code usage?
SAP Learning names Usage and Procedure Logging as one tool for collecting extension usage data, and SAP Community answers recommend SCMON for monitoring custom-code usage. SUSG aggregates the collected data, and the Custom Code Migration app, described in SAP’s Custom Code Migration Guide for SAP S/4HANA 2025, supports identifying unused custom code from that usage data. There is no standard ABAP facility that simply lists unused code, so monitoring has to be switched on and given time to run.

