Skip to Content
Technical Articles
Author's profile photo Taranam Dhindsa

Cleanup of unused Custom Code during S/4HANA Upgrade

As we know SAP has 5 year mainstream maintenance window for each S/4HANA release ; customers need to keep their S/4HANA systems upgraded on regular basis to comply with S/4HANA maintenance . After the end of mainstream maintenance, the release usually enters customer-specific maintenance. Nowadays S/4HANA Upgrades are catching up considering 1511 and 1610 are already out of maintenance and clients having long implementation journey are upgrading their S/4HANA landscape during the build itself to leverage S4HANA new innovations released with every new release

Now many customers doing S/4HANA Technical Upgrade always have query on cleanup of their unused code as some of the objects created initially during implementation are not used .But they have concerns that if at later point what if they need that code again. Few of Qs asked by clients are :

  • How to remove unused code to clean up my core
  • Where to keep backup of deleted code ; in case its required at later point
  • How to restore backup code

So if you plan to reduce custom code footprint by deleting unused code in your landscape along with your S4HANA Upgrade; this blog addresses these queries and we have leveraged S4HANA new tools and apps to achieve the same

Prerequisites :

  • S/4HANA 1909 or higher (since we are using gCTS)
  • GitHub License and set up
  • CCM(Custom Code Migration) and gCTS app enabled in your system

We are covering deletion of unused code using CCM and gCTS app in this blog ; so traditional way for code deletion(manually) and backup (TRs/abapgit) is not covered in this .

High level steps are listed below under 5 umbrellas as shown below :


  1. Scoping: First step is to define the scope of objects that you want to retain and the ones you plan to delete during the S4HANA Upgrade. We can create Deletion Transport using CCM app.
  • Firstly, create Project in CCM app and once its Ready for Scoping; you can remove the packages from Scope using option ‘Remove Package from Scope’


  • Then on Projects main page; click on ‘Create Deletion TR’ and it will create the Deletion TR having packages that have Scope information as ‘Not in Scope’


  • You can validate the Deletion TR content in transaction SE01


     2.  Backup: Using gCTS Fiori app we can push the package to GitHub repository before deleting the unused objects from system. GitHub repository will act as backup for the custom code.


Once the gCTS is released; you will find the same under gCTS Fiori app under Commits Tab. You can also validate the same under your GitHub repository as well.

3. Remove: During Upgrade of your S/4HANA system; you can provide Deletion TR during SUM phase as shown below :



4. Validate: Once the S/4HANA system is upgraded; you can validate if the objects defined in Deletion TR have been removed /not.

5. Restore: Later at any point if you need to restore the deleted objects , you can restore the same from GitHub repository .It’s very well covered in Blog here

In this Blog; I have covered usage of Fiori apps CCM and gCTS for unused custom code deletion, backup and restore .

Please do share your experiences .


Thanks and Regards


Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Norbert Frühwein
      Norbert Frühwein

      Hi Taranam,
      nice blog.

      Does it makes sense to scope on package level?

      There are many customers, having just one packacke, or all applications use coding through all packackes.

      How can you identify dependencies?

      Other topic: Talking about "asset saving" you would need a program, that gets all objects, necessary for an application/transaction and create a transport out of this.

      Best regards