Get started with the ABAP custom code migration process

Over past years SAP customers have heavily extended and modified SAP solutions. There are SAP ERP systems with a few million lines of custom code. During a system conversion to SAP S/4HANA or a migration to SAP BTP ABAP Environment customers want to reuse the existing custom code.

Simplified the custom code migration process looks like this: you need to define the scope of custom code for migration, analyze it for SAP S/4HANA or cloud readiness, migrate it to the new environment and adapt it for SAP S/4HANA or SAP BTP ABAP Environment accordingly.

Custom Code Migration App and ABAP Development Tools in Eclipse with Quick Fixes are the tools of choice for custom code analysis and adaptation supporting custom code projects within an SAP S/4HANA conversion or a migration to SAP BTP ABAP Environment. Since custom code migration topic is so important for the SAP customers, we have included the Custom Code Migration app into the RISE with SAP offer, and it is available in every RISE with SAP subscription. For more information see also the blog RISE with SAP and custom code migration – What is included.

In the following we will take a closer look at the process steps of the custom code migration to SAP S/4HANA and SAP BTP ABAP Environment and give you the recommendations on which information can assist you during realization of your tasks at each process step.

Recommendation – Collect usage data

In an average SAP ERP system, a large part of custom code is never executed in the production. Therefore, removing unused and obsolete code will significantly reduce the effort for custom code adaptation. SAP recommendation is at least 1 year prior to your SAP S/4HANA conversion project or migration project to SAP BTP ABAP Environment to collect usage data in your productive systems using ABAP Call Monitor (SCMON) and SUSG transactions. See the blogs ABAP Call Monitor (SCMON) – Analyze usage of your code and Aggregate usage data in your production system with SUSG transaction for details. If you already collected (or still collect) usage data with the SAP Solution Manager and UPL (Usage Procedure Logging) these usage data can be also considered.

Custom code migration to SAP S/4HANA

The central entry point to the topic of the custom code migration to SAP S/4HANA is the blog SAP S/4HANA System Conversion – Custom code adaptation process. All frequently asked questions along with the answers regarding this topic are collected in the Custom code adaptation for SAP S/4HANA – FAQ.

Scope

First you need to define a custom code scope for migration. For this we recommend setting up the Custom Code Migration app. In the Custom Code Migration app you can create a custom code migration project and upload your collected usage data (if available). If you collected the usage data with the SAP Solution Manager see the blog How to upload usage data from the SAP Solution Manager to the SAP Fiori App Custom Code Migration. If you upload the collected usage data, the app will define the initial custom code migration scope based on the usage data. Afterwards you can adjust the scope manually. We also recommend using the complexity analysis in the Custom Code Migration app to refine the scope by spotting top TCO drivers in your custom code. See the blog Custom code analysis for SAP S/4HANA with SAP Fiori App Custom Code Migration for more details on the technical setup of the Custom Code Migration app and scoping of your custom code for migration.

Analyze

Next you need to analyze your custom code for the compatibility with the SAP S/4HANA. Custom Code Migration app performs SAP S/4HANA readiness checks over your custom code in the SAP ERP system and provides detailed analysis results with advanced filtering and navigation capabilities and various chart views. These SAP S/4HANA analysis results should be used as a foundation for all custom code adaptation activities. See the blog Custom code analysis for SAP S/4HANA with SAP Fiori App Custom Code Migration for more details on custom code analysis.

Migrate

During system conversion, the SAP Software Update Manager will take over all your custom code from the SAP ERP source system into the target SAP S/4HANA system. Prerequisite is that the respective object catalog and software component information are correctly maintained for your custom code objects (see the SAP Note 2318321). During scoping the Custom Code Migration App allows you to specify custom code objects that shall not be taken over. A respective transport request is generated by the app. You can then provide this request to the Software Update Manager so that the tool will exclude those objects during the transition to SAP S/4HANA.

Alternatively, it is also possible to outsource and backup the unused custom code after system conversion, see the blog How to backup custom code with gCTS for more details.

Adapt

The adaptation of your custom code to SAP S/4HANA takes place after the system conversion. We recommend using ABAP Development Tools in Eclipse for all custom code adaptation activities. You can significantly reduce your custom code adaptation efforts with the mass-enabled Quick Fixes in the ABAP Development Tools in Eclipse. Prerequisite for applying Quick Fixes is the local ABAP Test Cockpit run with the SAP S/4HANA readiness checks executed in the ABAP Development Tools in Eclipse over your custom code in the new SAP S/4HANA system. For details on the custom code adaptation using the Quick Fixes see the blog Semi-automatic custom code adaptation after SAP S/4HANA system conversion.

Recommendation – Optimize your custom code

Your system conversion to SAP S/4HANA is a given opportunity to invest into modernization of your custom code and clean core. First, we recommend optimization of your custom code for SAP HANA by adapting your performance critical SQLs found by the SQL monitor.  Additionally, you can utilize SAP HANA usage by using ABAP CDS, AMDP and ABAP SQL. Further significant optimization can be achieved if you use only released public APIs from ABAP platform and SAP S/4HANA to make your custom code cloud-ready and upgrade-stable.

The use of the SAP Fiori UI and ABAP RESTful Application Programming model (RAP) will help you to modernize your custom code. We also recommend reenforcing clean core for your system by looking for the appropriate use cases to be transformed into the side-by-side extensions in the SAP BTP ABAP Environment.

Custom code migration to SAP BTP ABAP Environment

Scope

First you need to define the custom code scope for migration. For this we recommend setting up the Custom Code Migration app. In the Custom Code Migration app you can create your custom code migration project. If you already know, which ABAP application you want to migrate to the SAP BTP ABAP Environment then you just define the scope manually by taking this ABAP application into the scope. If you need first to find out, which ABAP custom code is suitable for cloud, we recommend you to proceed as following. Start with uploading the collected usage data (if available). If you collected the usage data with the SAP Solution Manager see the blog How to upload usage data from the SAP Solution Manager to the SAP Fiori App Custom Code Migration. The app will define the initial custom code migration scope based on the usage data. Afterwards we recommend applying the complexity analysis to the scoped custom code to track down top TCO drivers (complex custom code) as possible candidates for migration and finally the dependency analysis to determine custom code candidates, which are loosely coupled with SAP standard. In this way the custom code scope will be defined and refined. See the blog How to check your custom ABAP code for SAP BTP ABAP Environment for more details on the technical setup of the Custom Code Migration app and scoping your custom code for cloud migration. To finalize the custom code scope for cloud you need to assess the remaining scope with your business department to select the appropriate use cases for the cloud.

Analyze

Next you need to analyze your custom code for the cloud. Custom Code Migration app performs cloud readiness checks over your custom code in the SAP ERP system and provides detailed analysis results with advanced filtering and navigation capabilities and various chart views. These analysis results should be used as a basis for all custom code adaptation activities for cloud. See the blog How to check your custom ABAP code for SAP BTP ABAP Environment for more details on custom code analysis.

Migrate

For the custom code migration to the SAP BTP ABAP Environment we recommend the abapGit. You can export your custom code to the external Git repository using the abapGit plugin in your on-premise ERP system and import it into the cloud ABAP system in the SAP BTP ABAP environment using the abapGit plugin in the ABAP Development Tools in Eclipse. See also the blog How to bring your ABAP custom code to SAP BTP ABAP Environment for more details on the custom code migration with the abapGit.

Adapt

The adaptation of your custom code to the SAP BTP ABAP Environment takes place in the cloud ABAP system within the SAP BTP ABAP Environment with ABAP Development Tools in Eclipse. You can also benefit from the mass-enabled Quick Fixes to reduce your custom code adaptation efforts. Prerequisite for applying the Quick Fixes is the local ABAP Test Cockpit run with cloud readiness checks executed over your custom code in the cloud ABAP system within the SAP BTP ABAP Environment in the ABAP Development Tools in Eclipse. For details on the custom code adaptation for cloud using Quick Fixes see the blog Semi-automatic custom code adaptation for SAP BTP ABAP Environment.