Workik.

SAP S/4HANA Custom Code Migration: An ABAP Developer's Guide

Finding Unused Custom Code with SCMON and SUSG

Configure ABAP Call Monitor (SCMON) and transaction SUSG to collect production usage data and isolate unused custom objects for system decommissioning.

Harbor Supply Co. has accumulated roughly 4,000 custom repository objects across fifteen years of running SAP ECC (ERP Central Component). If the team attempts to check, fix, and test every single object for SAP S/4HANA compatibility, they will spend hundreds of hours modifying programs that nobody uses. SAP has estimated that, on average, about 60% of custom code never runs in production (SAP, ABAP Call Monitor material, 2017). You must measure your own system to know your actual number. Decommissioning unused code before your conversion eliminates remediation work and slashes testing cycles.

Previous lesson: The Simplification List: What Changed in S/4HANA | Next lesson: Running S/4HANA Readiness Checks with ABAP Test Cockpit


Why Custom Code Usage Data Matters

Every custom report you carry into SAP S/4HANA requires evaluation against the Simplification Database. If you remediate code that business users abandoned five years ago, you burn project budget for zero return.

At Harbor Supply Co., developers built reports for discontinued product lines and one-off audits. For instance, the system holds three variations of goods movement reporting, but warehouse clerks only run ZMM_STOCK_MOVES. The other two reports sit untouched. By identifying which objects execute in production, you can separate active custom assets from dead code.

You do not need to guess which programs run. SAP provides native monitoring tools directly inside your SAP NetWeaver application server to record exact execution statistics down to the procedure level.

Pro Tip: Do not rely on user surveys to decide what code to keep. Business units almost always claim they need every report. Hard usage telemetry gives you objective facts for scope discussions.


Recording Execution with ABAP Call Monitor (SCMON)

ABAP Call Monitor (SCMON) is the standard tool to capture custom code execution in modern ABAP systems. On older SAP NetWeaver support package stacks, the same tool runs under transaction /SDF/SCMON. SCMON logs every call to reports, function modules, class methods, and subroutines directly within the ABAP runtime environment.

Unlike older trace tools like ST03N, which only log transactions and top-level reports, SCMON records deep call stacks. If a standard order transaction invokes a custom user exit or BAdI (Business Add-In), SCMON records the execution of that specific custom subprogram.

SCMON writes raw data into system memory buffers and flushes records into database buffer tables. By default, SCMON retains raw call records for only 7 days. Because of this short buffer, SCMON is not designed to serve as a long-term analytical store on its own.

Common Mistake: Do not run SCMON alongside Usage Procedure Logging (UPL). UPL is the legacy usage collection mechanism connected through SAP Solution Manager. Running both tools at the same time introduces unnecessary logging overhead on the production application servers. Turn off UPL before activating SCMON.


Aggregating Long-Term History with SUSG

Because SCMON keeps raw data for only 7 days, you need a way to build a multi-month historical record without exhausting database space. Transaction SUSG solves this problem by aggregating SCMON raw data inside your production system.

SUSG runs a scheduled daily background job that reads the short-term SCMON buffer tables, groups the call counts by program and object type, and updates compact long-term history tables. The long-term history keeps what you need for scoping, such as which objects ran and how often, without storing every individual call.

SAP Note 2643357 and SAP Note 2701371 provide the technical prerequisites, correction instructions, and configuration steps for SCMON and SUSG on supported SAP NetWeaver releases.

The setup follows this order:

  1. Check that the SAP Notes above are implemented in your production system.
  2. Activate the ABAP Call Monitor in transaction SCMON.
  3. In transaction SUSG, activate the daily aggregation so that SCMON data is collected into the long-term history.
  4. Confirm the next day that the aggregation job ran and that new usage records appear in SUSG.

Agree on the setup with your Basis team, because both tools run in production.

Once active, SUSG maintains a cumulative record of all custom code execution across the entire collection period.


Defining the Monitoring Duration

Usage patterns in an enterprise system vary by week, month, and season. Running a trace for two weeks will miss essential programs that support periodic business events.

You should collect usage data for a minimum of 6 to 18 months before finalizing your conversion scope. Twelve months is a safe default. A window of this length captures:

  • Month-end financial closes.
  • Quarterly tax and audit reporting.
  • Seasonal peak cycles, such as holiday shipping spikes for Harbor Supply Co.
  • At least one full year-end closing.

If you skip capturing a year-end closing, you risk flagging year-end reporting programs as unused and accidentally deleting them during cutover.

Quick Challenge: Check when your company's fiscal year closes. Schedule your custom code analysis so that the SUSG collection spans at least one complete fiscal closing cycle before you freeze your migration scope.


Building a Decommissioning Scope and Deletion Transports

Once your SUSG data covers an adequate collection window, you can construct a definitive deletion scope. Objects with zero recorded executions over twelve months are primary candidates for decommissioning.

The high-level decommissioning workflow follows four practical steps:

  1. Extract Usage Telemetry: In transaction SUSG, choose the export function to generate a snapshot file of aggregated usage data. You can also connect the data directly to the Custom Code Migration app on SAP BTP (Business Technology Platform) or an existing S/4HANA central system via RFC (Remote Function Call).
  2. Review Candidate Objects: Filter out false positives. Certain programs, like disaster recovery routines or conversion reload reports, never run during standard operations. Move these into an exception list.
  3. Blocking Before Deleting: Before deleting objects, remove transaction codes from user menus or apply authorization locks. If a business user reports that an essential job fails, you can unlock it immediately without recovering any code.
  4. Create the Deletion Transport: Use the Custom Code Migration app or standard ABAP transport tools to assemble a transport request containing deletion records for all confirmed dead objects. Release this transport in your ECC development system, test the transport sequence in QA, and import it into production prior to the final S/4HANA conversion run with Software Update Manager (SUM).

By deleting dead code in ECC before the conversion runs, you ensure that ATC (ABAP Test Cockpit) checks only the code Harbor Supply Co. actually needs in S/4HANA.


Try It Yourself

Verify the status of custom code tracking in your development or sandbox system by inspecting SCMON and SUSG directly:

  1. Log into your system and enter transaction code SCMON in the command field. (If the transaction does not exist, run /SDF/SCMON).
  2. Check whether the monitor is currently active and since when it has been collecting data.
  3. Open transaction SUSG.
  4. Check whether the daily aggregation is active and when it last ran.
  5. Display the aggregated usage data and look for objects from your custom Z* packages to confirm that recent executions appear.

In the next lesson, Running S/4HANA Readiness Checks with ABAP Test Cockpit, you will set up ATC with the S4HANA_READINESS check variant to evaluate remaining active custom code against the Simplification Database.

Was this lesson helpful?