Lesson 5 of 5
Testing
12 min
Listen to this lesson
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
Choose depth by risk
| Adaptation type | Usage | Test depth |
|---|---|---|
| Untouched by findings | Any | Covered by business process regression only |
| Mass quick fix (declarations, field lengths) | High | Unit tests where they exist plus a smoke test of the main function |
| Manual change to logic or data access | High | Functional comparison with ECC output, plus business process test |
| Manual change to logic or data access | Low | Functional comparison; owner signs the result |
| Replaced by standard | Any | Business process test with the new function; user acceptance |
| Interfaces and forms | Any | End-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.
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.
- Does it run without errors or short dumps?Yes → next question · No → defect; check the SAP Note behind the finding
- Do the results match ECC for the same selections?Yes → next question · No → defect; trace the data access that changed
- Is the runtime acceptable?Yes → pass · No → performance defect; trace and tune, or move to a standard app
Building a comparison, step by step
- Choose a closed period and fixed selections, so production ECC (EP1) and the converted copy in CMQ hold the same data for it.
- Run the program in EP1 (read-only) and in CMQ with the same variant, and export both results in the same layout.
- Compare totals first (record counts and sums by key), then line by line where the totals differ.
- Record both runtimes. Contoso’s rule: anything more than twice as slow gets a trace.
- Explain every difference: a defect, an expected SAP S/4HANA change (documented in the simplification item), or data timing.
- 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 type | Contoso example | Who fixes it |
|---|---|---|
| Functional difference | Core return report shows extra rows after the status rewrite | Kenji’s team, with Maria (O2C key user) confirming the result |
| Short dump | Type conflict when a widened material number is passed to an older custom function | Developer who owns the package |
| Performance | Warranty accrual runs 3 hours instead of 20 minutes | Kenji’s team; Dan sets the deadline |
| Interface layout | Fixed-length file to a partner shifts its columns | Theo’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.
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?
- 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. Why must adapted custom code be tested even after a clean ATC run?
2. Which objects deserve the deepest testing?
3. What is the strongest functional test for an adapted report?
4. An adapted program returns correct results but runs nine times slower. What is it?
5. Why compare an adapted report with ECC for a closed period?