Now accepting guest editorial from SAP, Oracle, Workday and ServiceNow practitioners.Pitch a guide
The Sign-Off Table

Lesson 5 of 5

Testing

12 min

Listen to this lesson

0:00 / 8:59

SAP's conversion guide is clear that the checks are not the end: in addition to analysis and adaptation, you also need to test the custom code within SAP S/4HANA, because the checks do not yet find every instance where code does not comply. For a test lead like Priya the challenge is depth. Contoso adapted thousands of objects; testing each one in isolation would take longer than the program has. The answer is to test by risk and by process, using what scoping and adaptation already recorded.

Layers of evidence

Business process testsEnd-to-end flows that run custom code in context: order to cash, procure to pay, close
Functional tests per objectReports, interfaces, forms and enhancements compared with ECC output
Unit testsABAP Unit tests for adapted classes and function logic
Static checksClean ATC readiness run; code review of a sample of quick fixes
Each layer catches different defects. Lower layers are cheap and fast; upper layers prove the business works.
The Sign-Off Table · thesignofftable.com/academy/sap-s4t-301

Choose depth by risk

Adaptation typeUsageTest depth
Untouched by findingsAnyCovered by business process regression only
Mass quick fix (declarations, field lengths)HighUnit tests where they exist plus a smoke test of the main function
Manual change to logic or data accessHighFunctional comparison with ECC output, plus business process test
Manual change to logic or data accessLowFunctional comparison; owner signs the result
Replaced by standardAnyBusiness process test with the new function; user acceptance
Interfaces and formsAnyEnd-to-end test with the partner system or printed output

Contoso's test depth rules for adapted custom code.

Usage data helps twice: it showed what to keep, and it now ranks what to test hardest. Map each adapted object to the transactions and jobs that call it, then to the business processes in the regression set. Objects that are adapted and heavily used deserve the most attention; adapted objects that nothing in the regression set calls are a gap to close.

Traceability for adapted code: each object maps to what calls it and to the processes in the regression set; an adapted object with no path to a test is a gap.
The Sign-Off Table · thesignofftable.com/academy/sap-s4t-301

Compare with ECC

For reports, extracts and calculations, the strongest functional test is a comparison: run the program in ECC and in the converted system for the same period and selections, and compare results. The converted quality system is a copy of production, so the data is real. Time the runs too; a program that now reads through a compatibility view or a changed data model can be correct but slow. For a slow program, an SQL trace (ST05) shows where the time goes.

  1. Does it run without errors or short dumps?Yes → next question · No → defect; check the SAP Note behind the finding
  2. Do the results match ECC for the same selections?Yes → next question · No → defect; trace the data access that changed
  3. Is the runtime acceptable?Yes → pass · No → performance defect; trace and tune, or move to a standard app
Functional comparison of an adapted program.
The Sign-Off Table · thesignofftable.com/academy/sap-s4t-301

Building a comparison, step by step

  1. Choose a closed period and fixed selections, so production ECC (EP1) and the converted copy in CMQ hold the same data for it.
  2. Run the program in EP1 (read-only) and in CMQ with the same variant, and export both results in the same layout.
  3. Compare totals first (record counts and sums by key), then line by line where the totals differ.
  4. Record both runtimes. Contoso’s rule: anything more than twice as slow gets a trace.
  5. Explain every difference: a defect, an expected SAP S/4HANA change (documented in the simplification item), or data timing.
  6. Attach both files and the verdict to the test case in SAP Cloud ALM as evidence.

Performance tools. ST05 traces one run. Before the conversion, the SQL Monitor (SQLM) in production shows which custom SQL statements run most often and cost most, and the SQL Performance Tuning Worklist (SWLT) combines that runtime data with static findings to rank what to tune. When the time is spent in ABAP rather than the database, the runtime analysis SAT shows where.

Unit tests that survive the conversions. ABAP Unit tests run from ADT in seconds. For rewritten data access, use the ABAP SQL test double framework (and the CDS test double framework for CDS views), so a test supplies its own table data instead of depending on whatever CMQ holds after the next refresh. Joule for developers can draft unit tests; a developer still checks that the assertions test the business rule.

Defect typeContoso exampleWho fixes it
Functional differenceCore return report shows extra rows after the status rewriteKenji’s team, with Maria (O2C key user) confirming the result
Short dumpType conflict when a widened material number is passed to an older custom functionDeveloper who owns the package
PerformanceWarranty accrual runs 3 hours instead of 20 minutesKenji’s team; Dan sets the deadline
Interface layoutFixed-length file to a partner shifts its columnsTheo’s integration team with the developer

Classifying custom code defects so each goes straight to the right owner.

Make it repeatable

Evidence that outlives the program. In SAP Cloud ALM, Priya keeps each comparison as a test case in the test plan for the cycle, with the custom objects it covers named in the test case. Defects raised from a failed comparison link back to that test case, so a re-test after Kenji’s fix lands on the same record. When the auditors or the next upgrade team ask how an adapted program was proven, the answer is the test case with both result files, not a chat message.

After the sandbox, Contoso converts CMD and CMQ, then rehearses the production conversion three times in CMQ refreshed from a copy of EP1 (Mock 1, Mock 2 and the dress rehearsal), and finally converts CMP. The same tests should run after each, so automate where it pays. ABAP Unit tests run in seconds after every transport. Comparison checks can be scripted with saved variants and stored outputs. Business process regression for the most used flows is a good candidate for SAP's own test tooling and SAP Cloud ALM test management, where results and defects are linked to the requirements and features they cover.

Every conversion in the sequence reruns the same custom code tests, which is why automation pays.
The Sign-Off Table · thesignofftable.com/academy/sap-s4t-301

What would you do?

In CMQ, the custom warranty accrual program returns the same totals as ECC, but now runs for 3 hours instead of 20 minutes. It runs once a year at year-end. What should Priya do?

Key points
  • ATC checks do not find everything; adapted code must be tested in SAP S/4HANA.
  • Set test depth by adaptation type and usage; map objects to the regression set.
  • Compare outputs and runtime with ECC for the same selections.
  • Automate unit, comparison and regression tests, since each conversion repeats them.
  • Compare on a closed period; use SQLM, SWLT, ST05 and SAT for speed, and test doubles for unit tests.

Check your understanding · not graded

Lesson check

  1. 1. Why must adapted custom code be tested even after a clean ATC run?

  2. 2. Which objects deserve the deepest testing?

  3. 3. What is the strongest functional test for an adapted report?

  4. 4. An adapted program returns correct results but runs nine times slower. What is it?

  5. 5. Why compare an adapted report with ECC for a closed period?