The clock is ticking for organisations using legacy SAP systems. With the 2027 end-of-support deadline looming, enterprises across industries are racing to migrate to SAP S4 HANA. But what happens to decades of custom business logic built into these legacy systems? Our recent project with the world’s largest building society revealed both the challenges and solutions.

When COBOL Meets Cloud: The Technical Challenge

The world’s largest building society approached us with a significant technical challenge during their SAP S4 HANA migration. At the heart of their customer data management was a critical deduplication process—forward congruency logic—written in COBOL, a programming language developed in the 1950s that remains in many legacy financial systems.

This forward congruency code served as the foundation of their customer database integrity, systematically preventing duplicate customer records from entering their systems. Daily, it processed thousands of incoming customer records, comparing them against existing data to accurately determine whether they represented new customers or updates to existing profiles.

The stakes were exceptionally high. Any failure in this code during migration would result in serious consequences: corrupted customer data, transaction failures, and potentially significant financial and reputational damage.

Systematic Code Analysis and Translation

Our approach began with a comprehensive analysis of the legacy system. With COBOL developers becoming increasingly scarce in the industry, we assembled a specialised team to methodically deconstruct the existing code structure.

The analysis required meticulous attention to detail as we examined each component to understand both its function and purpose within the larger system. Much of the logic originated in the 1980s, characterised by minimal documentation and domain-specific nomenclature. We encountered numerous instances of specialised business rules with limited explanation, such as region-specific processing requirements added decades ago.

The technical challenge extended beyond simple code translation. We needed to bridge fundamentally different programming paradigms: COBOL—a procedural language designed for sequential batch processing on mainframes—and PySpark, a distributed processing framework engineered for parallel cloud-scale data operations.

Architectural Transformation

As the project developed, it became evident that this initiative extended beyond straightforward code translation. We were undertaking a fundamental architectural transformation to achieve identical business outcomes in a substantially different computing environment.

The technical differences were significant: COBOL processes records sequentially in a linear fashion, while PySpark distributes data processing across numerous parallel processors. This required completely rethinking the execution flow while preserving the exact business logic.

Our testing methodology addressed this complexity through comprehensive validation. We developed a testing framework that generated over 10,000 distinct test scenarios covering every possible combination of input variables. Each scenario was processed through both the original COBOL and our new PySpark implementation, with outputs systematically compared using automated validation tools to verify complete functional equivalence.

Performance Optimisation Beyond Functional Equivalence

A significant challenge emerged after achieving logical equivalence. While our implementation made identical decisions to the original code, initial performance metrics were suboptimal. The distributed nature of PySpark revealed that operations efficient in sequential COBOL created processing bottlenecks in a parallel computing environment.

This necessitated a sophisticated optimisation approach: maintaining absolute functional equivalence while restructuring data flow operations to leverage distributed computing capabilities. The solution required precise preservation of decision logic while completely redesigning the underlying data processing architecture.

The final implementation delivered exceptional results: 100% functional equivalence with the legacy system while processing data approximately 15 times faster than the original COBOL code, providing both business continuity and significant performance improvements.

Lessons for the SAP Migration Wave

This project illuminated several critical lessons for organisations undertaking similar migrations.

1. Business logic preservation requires expertise in both old and new paradigms.
The most dangerous migrations are those where the team understands the destination technology but not the origin.

2. Testing must be exhaustive, not representative. When migrating critical business logic, testing a few scenarios isn't enough—you need to validate every possible path through the code.

3. Performance can't be an afterthought.
The architecture of modern distributed systems fundamentally differs from legacy mainframes, requiring careful consideration of how logic flows through the system.

4. Documentation is your future-proofing strategy.
We created comprehensive documentation mapping the old logic to new implementations, ensuring the client wouldn't face the same archaeology expedition during their next migration.

Beyond Forward: The Future of Master Data Management

While this project focused specifically on forward congruency (how incoming data integrates with existing records), it opened conversations about the broader data ecosystem. Our client is now engaging us for reverse congruency implementation—ensuring data flowing out from the master database to downstream systems maintains consistency.

The larger trend is clear: as organisations modernise their core systems, they're simultaneously raising their ambitions for what their data can do. Legacy modernisation isn't just about maintaining existing capabilities—it's about establishing the foundation for future innovation.

This article is based on our recent work with the world's largest building society. For a more detailed case study of this SAP S4 HANA migration project, including our methodology and outcomes, download our comprehensive Use Case.

Your Migration Journey

As the 2027 deadline approaches, thousands of organisations face similar journeys. The key question isn't whether to migrate—that decision is essentially made for you by SAP's support timeline—but how to migrate while preserving the business logic that makes your organisation unique.

The code running in your legacy systems represents decades of accumulated business knowledge. Our experience shows that with the right approach, this knowledge can not only be preserved but enhanced as you move to modern platforms.