Custom Code Remediation for S/4HANA
Custom code is both the strength and Achilles heel of SAP implementations. While it enables business-specific processes, it's also the #1 blocker for S/4HANA migration. This guide provides a systematic approach to identify, prioritize, and remediate custom code for successful S/4HANA transformation.
Reality Check:
- • Average enterprise has 50,000-200,000 lines of custom ABAP code
- • 30-40% requires modification for S/4HANA compatibility
- • Manual remediation: 6-12 months of effort
- • Automated tools reduce timeline to 2-4 months
Why Custom Code Breaks in S/4HANA
S/4HANA's simplified data model eliminates thousands of database tables, changes field lengths, and deprecates function modules. Your custom code likely relies on these structures.
Incompatible Code Patterns
- • Direct table access to obsolete tables (BSEG, KONV)
- • Use of deprecated function modules
- • Hard-coded field lengths (now changed)
- • Pool/cluster table reads (now standard tables)
- • Custom enhancements in modified SAP code
S/4HANA Alternatives
- • CDS views for data access
- • Released BAPIs and APIs
- • Dynamic field sizing
- • Standard table access
- • BAdI implementations (not modifications)
Phase 1: Discovery & Assessment
Step 1: Run SAP Readiness Check
SAP provides the Readiness Check tool (transaction SYCM or via SAP Support Portal).
Step 2: Classify Custom Code
Classification Matrix:
Example: Order processing Z-program accessing BSEG directly
Example: Reporting using deprecated FM, will work but slow
Example: Rarely-used utility program with field length mismatch
Example: Programs not executed in 2+ years, delete instead of fix
Phase 2: Remediation Strategies
Strategy 1: Replace with Standard SAP Functionality
Best case scenario: S/4HANA now offers standard functionality that replaces your custom code.
Example:
Custom credit management program → S/4HANA Advanced Credit Management (Fiori app)
Action: Decommission custom code, train users on new Fiori app. Zero remediation effort.
Strategy 2: Refactor to Use CDS Views
Replace direct table access with CDS consumption views.
Before (ECC):
After (S/4HANA):
Strategy 3: Update Field Lengths
S/4HANA extended key fields from 10 to 40 characters. Hardcoded lengths cause dumps.
❌ Problem Code:
✅ Fixed Code:
Strategy 4: Replace Deprecated Function Modules
SAP provides the Simplification Database listing deprecated objects and replacements.
Common Replacements:
Phase 3: Testing Strategy
Multi-Layer Testing Approach
1. Unit Testing (ABAP Unit)
Test each remediated program in isolation with sample data
2. Integration Testing
Run end-to-end business processes in QA system
3. Performance Testing
Compare execution times vs. ECC baseline (CDS should be faster!)
4. User Acceptance Testing (UAT)
Business users validate outputs match expectations
Automated Tools for Remediation
SAP Native Tools
- ATC: Built-in code inspector
- Readiness Check 2.0: Comprehensive analysis
- Custom Code Migration App: Fiori-based workbench
Third-Party Solutions
- Automated refactoring tools (AI-assisted)
- Impact analysis platforms
- Code usage analytics (identify dead code)
Best Practices & Tips
- 1Start Early
Begin remediation 12-18 months before planned go-live. Custom code is always the bottleneck.
- 2Prioritize Ruthlessly
Fix only what's business-critical. Decommission 30-40% of unused code.
- 3Document Everything
Maintain a remediation tracker: Program name, issue, fix applied, tester, status.
- 4Involve Business Early
Some "fixes" change behavior. Get user buy-in before remediation.
- 5Monitor Post-Migration
Even "fixed" code may perform differently in S/4HANA. Monitor with SUPTime for runtime issues.
Conclusion
Custom code remediation is the most labor-intensive part of S/4HANA migration, but it's also an opportunity to modernize and simplify your SAP landscape. With systematic analysis, smart prioritization, and the right tools, you can turn this challenge into a competitive advantage.
Need Help with S/4HANA Migration?
SUPTime helps monitor custom code performance during and after migration to catch issues early.
Talk to Our Experts