Skip to Content
Technical Articles
Author's profile photo Olga Dolinskaja

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.

 

 

Assigned Tags

      18 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Christian Punz
      Christian Punz

      Hi Olga,

      great summary!
      What about the "good old" SWLT, where I was able to jointly see ATC-check-results (from DEV) with SQLM-performance (from PRD) and coverage/usage?

      Did SAP abandon this tool? Or is it integrated into ADT somehow and I'm blind?

      SWLT was helpful for the programmer on DEV because it showed 3 information fragments in one screen: "ah, ADT complained about SELECT *, SQLM shows bad access times at the complained code line and UPL/SCMON shows that this code is used very often. I have to improve the code to make the users happy". and navigate into the source and done.

      Any hint appreciated,

      BR

      christian

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author

      Hi Christian,

      currently we don't have another possibility or tool to integrate the SQLM data with the ATC performance data, therefore SWLT can be used further on. However the tool is SAP GUI-based.

      Kind Regards,

      Olga.

      Author's profile photo Thomas Fiedler
      Thomas Fiedler

      Hi Christian,

      thanks for the input. Do you have experience with the SQLM View in ADT?

      Isn't some kind of navigation from this view to the ATC view the required solution?

      Regards,

      Thomas.

       

      Author's profile photo Orhan Er
      Orhan Er

      Hi Olga,

      Thank you very much for the great summary.

      I have read all the articles you have written about Custom Code migration. I understood the details of many topics and applied it as a demo. For example, at the end:
      - I installed abapgit in SAP GUI.
      - I moved the Demo Custom Code samples (on SAP S/4 HANA on-Premise system - 4 class files) to github repository (Public) via SAP GUI (via abapgit).
      - Then I moved my demo custom codes on github (via the pull command) to my package that I created on the trial SAP BTP Abap Environment platform (via Eclipse abapgit).
      - then I migrated from SAP BTP environment (via stage and push command) to github repository (via Eclipse abapgit). On Github, I migrated it back to my on-Premise system.

      So in summary, I moved my custom codes easily via SapGui abapGit - github - Eclipse Abapgit. However, I have a lot of questions about some issues related to transporting my real Custom Codes. We can only try demo custom code with Trial SAP BTP and a Public github. My real Custom Codes contain many objects that SAP BTP does not support. For example reports, screen, etc.

      1. As far as I understand, these reports, screens will not be migrated when migrating my real Custom Codes to Sap BTP environment. Because Sap BTP does not support them. As a developer, I need to find solutions to these in the SAP BTP environment. It seems that there is a need for example videos especially on this subject. I think it would be very helpful if simple examples were made and shared. Or is there such an example for migration and I don't know? If yes, can you share the link?

      2. After the Custom Code migration, we will make API connections from the SAP BTP Abap Environment. So we will need an S/4 HANA system again, right? I know that we can use this system in the cloud environment or on-premise environment. Is this true?

      Kind Regards

      Orhan

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author

      Hi Orhan,

      yes, some objects like reports and Dynpros are not supported in the SAP BTP ABAP Environment. Besides that not all ABAP languages statements are supported, you should consider this as well (see the blog https://blogs.sap.com/2020/06/03/restricted-abap-for-sap-cloud-platform-abap-environment/). Therefore you should rebuild you custom code using SAP Fiori UIs and ABAP language version cloud. It is not possible to provide examples on how to replace on-premise custom code with cloud-ready code, it depends on your custom code application. For example if it is heavily built on Dynpros, accesses SAP application tables (which are on-premise) very frequently in loops, uses obsolete ABAP, contains modifications of SAP standard etc. then you would need to rebuild it even conceptually to reach cloud readiness. For some applications (like my example) it would make sense rather to implement it from scratch as to adapt it because of high rebuild and adaptation effort. 

      Regarding your second question: yes, if you need to connect from the SAP BTP ABAP Environment system to the SAP S/4HANA system, then of course you would need that system. See also all available Integration and Connectivity options.

      Kind Regards,

      Olga.

      Author's profile photo Orhan Er
      Orhan Er

      Hi Olga,

      Thank you very much for the quick answer. Yes our custom codes is heavily built on Dynpros, accesses SAP application tables (which are on-premise) very frequently in loops and contains modifications of SAP standard. And we should rebuild our custom code using SAP Fiori UIs (Frontend) and ABAP language version cloud (Backend).

      I know for this question, maybe the status of the project (after to SAP BTP ABAP Environment Migration) should be checked first, but for any project, is it usually advantageous to rebuild from the backend or the frontend first?

      Kind Regards

       

      Orhan

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author

      Hi Orhan,

      actually it would make sense to implement business logic first (backend) and then provide UIs (frontend). It is also recommendable to use RAP: https://community.sap.com/topics/abap/rap.

      Kind Regards,

      Olga.

      Author's profile photo Wolfgang Bauer
      Wolfgang Bauer

      Hello Olga,

      if you want to transfer a customer's own development to the cloud, you will definitely notice the many non-permitted data types or missing tables/data elements/structures (e.g. MARA) .

      What is the easiest way to solve this problem?

      Should the data types be rebuilt with Z-objects?

      That would be an immense effort.

      Kind Regards

      Wolfgang

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author

      Hi Wolfgang,

      for not-permitted ABAP data types we offer Quick Fixes in the ADT in Eclipse. See the blog https://blogs.sap.com/2019/10/01/semi-automatic-custom-code-adaptation-for-sap-cloud-platform-abap-environment/ . Also this new blog could be helpful: https://blogs.sap.com/2022/09/09/abap-language-versions-faqs/ Instead of direct accesses with OpenSQL to SAP application tables on-premise, the table data must be retrieved by using remote released APIs or replicated.

      Kind Regards,

      Olga.

      Author's profile photo Orhan Er
      Orhan Er

      Hello Olga,

      I want to migrate my SAP S/4 HANA Custom Codes to SAP BTP ABAP Environment. I am getting an error when pulling Custom Codes from Github via abapgit via Eclipse. I shared the screenshot.
      My problem: The original language of my work in the on-Premise system is DE (German) and the SAP BTP environment is EN (English).

      My Purpose: I have to change either the language of my custom codes in the on-Premise system or the original language of the SAP BTP ABAP Environment (Trial).
      Which is easier to do and how can I do it? By the way, I could not find it in the menus for the SAP BTP ABAP Environment. Could this be because SAP BTP is Trial? Is there such a setting for a full version SAP BTP ABAP Environment (setting to change the original language)?
      I think this is a very important issue.

       

      Kind Regards

      Orhan

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author

      Hi Orhan,

      you should logon to your SAP BTP ABAP Environment system in German. Just create a new ADT project and create a new one using logon DE language option.

      Kind Regards,

      Olga.

      Author's profile photo Orhan Er
      Orhan Er

      Hello Olga,

      Thank you very much for the information. Yes, I opened a new project via Eclipse and I was able to set the language of this new ABAP Environment instance on the first login.

      I have stated what I understand below. Can we say this is true?

      NOTE: You can specify an SAP BTP ABAP Environment original language only at your first connection from Eclipse. You cannot change the original language afterwards.
      When another original language is needed, the language can be set at first by creating a new ABAP Environment.

      Result: If we are going to perform a Migration, I have to create an SAP BTP ABAP Environment instance according to the original language of the on-Premise system.

      Thank you.

      Kind regards

      Orhan

      Author's profile photo Orhan Er
      Orhan Er

      Hello Olga,

      I have 3 ABAP Environment instances belonging to a subaccount in a Trial SAP BTP. However, except the first one I created, other instances constantly give 503 error. I don't know if there is a restriction on this in Trial accounts.

      You can also reach my question from this link. You can see it in the photos.

      https://blogs.sap.com/2021/06/09/can-not-connect-to-a-sap-btp-trial-abap-environment-instance/comment-page-1/#comment-640436

      Thank you very much

      Kind Regards
      Orhan

       

      Author's profile photo Samet Filiz
      Samet Filiz
      Hello Olga,
      
      Is it not possible to transfer all the developments in the ERP system directly to the S/4HANA system without using custom code analysis, that is, without using SUSG?
      The customer wants to migrate all development to S/4HANA without exception.
      
      Thank you.
      
      Kind regards,
      Samet
      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author

      Hi Samet,

      yes, of course it is possible to migrate all custom developments to SAP S/4HANA without usage data consideration (SCMON/SUSG).

      Kind regards,

      Olga.

      Author's profile photo Samet Filiz
      Samet Filiz

      Hello Olga,

      Thank you very much for the information.

      Is there a blog or guide on how we can do Custom Code Migration in this way? The documents we can access are those that can be made via SUSG. When we check the Custom Code Dashboard via Solman, we cannot see any application related to CCM. Do we need to activate the application? Or can we do it via GUI? Can we ask for Tcode or application name? We would like to migrate developments from ECC EHP7 SP11 (01/2016) to S/4HANA 2021 FPS02 (05/2022).

      Can we carry the repairs in the ECC system (eg MV45AFZZ, developments in standard codes, SAP Notes) with CCM?

      P.s.: It's not a brownfield conversion. The S/4HANA system has just been installed.

      Kind regards,

      Samet

      Author's profile photo Olga Dolinskaja
      Olga Dolinskaja
      Blog Post Author

      Hi Samet,

      SCMON/SUSG only collect usage data, these tools don't analyze or migrate custom code. You cannot use SolMan for the custom code analysis for SAP S/4HANA and you cannot adjust code for the S/4HANA on the ECC system, you need to do it only on the S/4HANA system. If really all custom code should be migrated to the greenfield S/4HANA system, then you need to transport the code to the new system via transport requests and then you can execute S/4HANA readiness checks and adapt it using ADT in Eclipse and Quick Fixes. See the blog Semi-automatic custom code adaptation after SAP S/4HANA system conversion for more details.

      Kind Regards,

      Olga.

      Author's profile photo Bjoern Weidner
      Bjoern Weidner

      Hi Samet,

      why would you go for a Greenfield implementation and then plan to take over all old custom code? If you want to use all the old custom code you can also do a system conversion. In that case, data is converted and doesn't have to be migrated.

      The approach we recommend is to use a new implementation (including all preconfiguration that comes with Enterprise Management Layer), utilise as much of the new S/4HANA standard functionality as possible, close the remaining gaps with the new extensibility options (whenever possible), and only then take over old ERP custom code.

      Best wishes

      Björn