November 25, 2026

Ayo Simak

Portal Fakta dan Tips Kekinian

Code Remediation Pattern Library: 50+ ABAP Before/After Examples for a Clean Core

SAP Clean Core

Decades of custom ABAP development have left many enterprise systems resembling a tangled Gordian Knot—pulling a single thread during a system upgrade can cause the entire technological infrastructure to shudder. In the past, modifying standard enterprise resource planning (ERP) systems was the default approach to meeting unique business requirements. Today, however, that legacy code has become an anchor, weighing down agility, inflating maintenance costs, and severely delaying digital transformation initiatives. To break free from this technical debt and prepare for modern, cloud-native ERP environments like SAP S/4HANA Cloud, organizations must aggressively pursue an SAP Clean Core strategy.

According to research by the Americas’ SAP Users’ Group (ASUG), an astonishing 60% of custom code residing in traditional SAP ECC systems is rarely or never used. Furthermore, Gartner analysts frequently highlight that highly customized ERP platforms demand significantly more time, budget, and testing effort during upgrade cycles. The mandate is clear: to leverage continuous innovation, artificial intelligence, and cloud agility, businesses must remediate their code.

But how do developers actually translate decades-old, classic ABAP into modern, upgrade-safe code? This is where a Code Remediation Pattern Library becomes an invaluable asset. By cataloging 50+ proven “Before/After” transformation patterns, development teams can systematically modernize their Z-Tables, BAdIs, User Exits, and core modifications without reinventing the wheel.

Understanding the Code Remediation Pattern Library

A Code Remediation Pattern Library is essentially a translation dictionary for SAP developers. It maps outdated, non-compliant programming paradigms to modern Cloud ABAP equivalents. Instead of relying on guesswork, enterprise architects and developers can reference specific patterns to handle common scenarios.

This library generally categorizes remediation efforts into three main extensibility tiers:

  1. Key User Extensibility: In-app modifications for simple UI changes, custom fields, and lightweight business logic.
  2. Developer Extensibility (Embedded Steampunk): Tightly coupled, upgrade-safe ABAP development directly on the S/4HANA stack using released SAP APIs.
  3. Side-by-Side Extensibility (SAP BTP): Decoupled applications and extensions built on the SAP Business Technology Platform, ideal for heavy integrations, external user access, and complex bespoke logic.

Below, we will explore some of the most critical structural patterns from the library, demonstrating how classic ABAP approaches are transformed to maintain a pristine digital core.

Deep Dive: ABAP Before & After Remediation Patterns

1. Core Modifications and User Exits (The MV45AFZZ Dilemma)

For years, the standard approach to tweaking SAP’s sales document processing was to write custom logic directly into user exit includes, such as the notorious MV45AFZZ.

Baca Juga :  Perhatikan Hal Berikut Sebelum Belajar SEO Digital Marketing

The Before Pattern (Classic ABAP): Developers would implement implicit enhancements or directly modify the standard include. This code often directly manipulated global variables (like XVBAP or YVBAP), bypassed standard validation checks, and intertwined custom business rules with core SAP logic. During an upgrade, these modifications would often break, requiring hundreds of hours of manual reconciliation in transaction SPAU.

The After Pattern (Cloud-Ready ABAP): Under a strict remediation strategy, direct modifications are strictly prohibited. Instead, developers migrate this logic using Developer Extensibility. SAP now provides released Business Add-Ins (BAdIs) that act as controlled extension points. The new code is written using Restricted ABAP (ABAP for Cloud Development), which prevents developers from accessing internal, unreleased SAP tables or using unsafe commands like direct database updates. If the logic is simple enough, it can even be shifted to Key User Extensibility via the Custom Logic app, ensuring the code is automatically carried forward during system upgrades without any manual intervention.

2. Custom Database Tables (Z-Tables)

Custom tables are the backbone of many legacy enterprise applications, storing everything from specific industry parameters to shadow copies of standard transaction data.

The Before Pattern (Classic ABAP): Classic development involved creating a Z-table (e.g., ZCUSTOM_DATA) and writing procedural ABAP programs with direct INSERT, UPDATE, and DELETE statements. Transactional consistency was maintained manually using COMMIT WORK, and locking was handled via traditional SAP enqueue/dequeue function modules. This approach lacked governance and made it difficult to expose the data to modern web interfaces like SAP Fiori.

The After Pattern (Cloud-Ready ABAP): Modern remediation transforms these standalone tables into managed entities using the ABAP RESTful Application Programming Model (RAP). Developers define a Core Data Services (CDS) view on top of the Z-Table to act as the data model. They then create a Behavior Definition (BDEF) and a Behavior Implementation class. RAP automatically handles the transactional buffer, locking mechanisms, and OData service generation. By adopting this pattern, the Z-table is no longer a dark corner of the database; it becomes a governed, scalable OData service that integrates seamlessly with SAP Fiori Elements and external applications.

3. Classic BAdIs to Cloud-Optimized Logic

While BAdIs are generally safer than direct modifications, classic BAdI implementations in ECC often contain massive amounts of technical debt.

Baca Juga :  Bikin Desain Makin Tajam dengan Teknologi Laser Cutting Metal

The Before Pattern (Classic ABAP): A developer implementing a classic BAdI might use SELECT statements to query unreleased SAP core tables (like BSEG or EKPO) directly. They might also call standard Function Modules that are classified as “Not Released for Customer Use.” Because the system allowed it, developers took the shortest path to solve the problem, unknowingly tying the system to a specific database schema that might change in the next SAP release.

The After Pattern (Cloud-Ready ABAP): When refactoring for a modern environment, the BAdI implementation must be converted to use strict Cloud ABAP. The key remediation pattern here is the API-First Approach. Instead of querying EKPO, the developer must consume a released Tier 1 CDS View (e.g., I_PurchaseOrderItem). If a function module is needed, they must find the released equivalent API. If an API is missing, developers utilize the 3-Tier Extensibility Model, creating a custom wrapper (Tier 2) around the unreleased SAP object, thus isolating the non-compliant code into a single, easily manageable layer while keeping the main logic (Tier 1) pristine.

4. Data Retrieval and Reporting

Classic reporting relied heavily on the ALV (ABAP List Viewer) framework and direct database queries.

The Before Pattern (Classic ABAP): Developers would write complex Open SQL or Native SQL queries directly against standard tables, sometimes hardcoding database hints. The data would be pushed into an internal table and rendered using REUSE_ALV_GRID_DISPLAY. This approach tightly couples the UI to the backend logic and bypasses application-level security and authorization checks.

The After Pattern (Cloud-Ready ABAP): The remediation pattern completely decouples data modeling from the UI. Developers build a Virtual Data Model (VDM) using CDS Views. These views push the computation down to the SAP HANA database (Code-to-Data paradigm), ensuring lightning-fast performance. UI annotations are added directly into the CDS view, and the report is exposed as an OData service. A Fiori Elements app is then automatically generated from these annotations, eliminating the need for classical ALV programming entirely and providing a responsive, device-agnostic user experience.

Establishing Your Remediation Factory

Migrating an entire enterprise system using these 50+ patterns is not a manual task—it requires a factory approach. To successfully execute this transition, organizations should follow a structured methodology:

  1. Assess and Analyze: Deploy the SAP Custom Code Migration App to scan your existing ECC system. This tool will identify which code is actively used (based on SCMON/UPL data) and highlight which lines of code are incompatible with S/4HANA and Cloud ABAP.
  2. Retire the Dead Weight: Be ruthless. If the code hasn’t been executed in the last 14 months, archive it and decommission it. Removing obsolete code is the fastest way to accelerate your project.
  3. Automate Refactoring: Leverage the ABAP Test Cockpit (ATC) and its Quick Fixes feature in ABAP Development Tools (ADT) for Eclipse. ATC can automatically apply many remediation patterns, such as replacing obsolete function modules or updating syntax, drastically reducing manual development effort.
  4. Manual Redesign: For complex business logic, architects must consult the Pattern Library to manually redesign the solution using RAP, CDS, or SAP BTP.
Baca Juga :  Menjadi Lebih Cerdas dalam Trading Forex dengan Cashback: Panduan Lengkap

The Vital Role of SAP BTP

While Developer Extensibility handles on-stack requirements, a true modernization strategy relies heavily on the SAP Business Technology Platform (BTP). If a legacy enhancement involves integrating with third-party logistics providers, managing massive data volumes, or building a completely bespoke user portal, the best pattern is often to extract the logic entirely from the ERP system. By utilizing SAP BTP (Side-by-Side Extensibility), you isolate the custom application, allowing the ERP core to remain untouched while your custom app scales independently using Node.js, Java, or the BTP ABAP Environment.

Conclusion

Transitioning to a modern SAP architecture is no longer just an IT upgrade; it is a strategic business imperative. Legacy customizations, while useful in the past, now serve as massive roadblocks to agility and innovation. By adopting a comprehensive Code Remediation Pattern Library, enterprise architects and developers can systematically eliminate technical debt, transforming monolithic Z-Tables, brittle User Exits, and non-compliant BAdIs into resilient, upgrade-safe cloud applications.

This journey from classic ABAP to modern extensibility requires deep technical expertise, strategic planning, and a mastery of SAP’s latest frameworks like RAP, CDS, and BTP. You do not have to navigate this complex architectural shift alone. To ensure a seamless, risk-free transition and to unlock the full potential of your ERP investment, reach out to SOLTIUS. Our team of certified SAP experts is ready to help you analyze your custom code footprint and build a robust roadmap toward a truly future-proof enterprise.