Skip to Content
Technical Articles
Author's profile photo Lars Hvam

Automagic standalone renaming of ABAP objects

Renaming ABAP objects is a tedious task, but can be necessary eg when sharing template code to avoid name clashes, or when changing the namespaces of objects.

abaplint can help to rename CLAS and INTF objects, it can run standalone on most CI pipelines like GitHub Actions. Code changes are performed by looking at semantics, ie. not regex-based.

Just setup the configuration,

"rename": {
  "output": "renamed",
  "skip": [],
  "patterns": [{"type": "CLAS|INTF", "oldName": "(.*)_rename", "newName": "$1_foobar"}]
},

 

and execute “abaplint –rename” via command line. As this is a generic tool, it can be used for various purposes, as the following example,

 

Practical Example: Orchestrating Changes

abapGit utilizes the ajson project by Alexander Tsybulsky, but it should still be possible to build the standalone report, not imposing requirements on the customer system.

This is solved by copying the ajson code, automatically renaming it, and opening a pull request with changes,

 

Overview

 

There is a daily job in the ajson_mirror repository which checks for code changes, renames, and pushes changes directly to ajson_mirror.

Similarly, for the abapGit repository, a job runs and opens a pull request with the updated renamed ajson code.

A developer can then review the changes and merge to the main branch, if there are any breaking changes, abaplint will find these and block the possibility to merge.

Assigned Tags

      11 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Sandra Rossi
      Sandra Rossi

      Thanks (again) for this illuminating blog post. I am a complete noob and I wanted to understand how it works. I have looked carefully at all the files you mention, and I don't find in the ajson_mirror action where do you indicate "abaplint --rename" so that to trigger automatically the renaming. If I understand well "abaplint --rename" uses the configuration in abaplint.json but I don't see where is the rename configuration; I found it in abaplint_rename.json but I don't understand how "abaplint --rename" can refer to a different json file. Could you explain a little bit more how it works or give some links? Thank you very much!

      Author's profile photo Lars Hvam
      Lars Hvam
      Blog Post Author

      Yea, there are some dots to connect 🙂

      The action triggers "npm run mirror", which performs multiple steps from https://github.com/abapGit/ajson_mirror/blob/main/package.json#L12, see documentation from NPM how the package.json works

      Author's profile photo Sandra Rossi
      Sandra Rossi

      Thanks, I got it now 🙂

      Author's profile photo Lars Hvam
      Lars Hvam
      Blog Post Author

      If you have NodeJS installed on your local pc, then its also possible to clone the project, run "npm install && npm run mirror" to try it out

      Author's profile photo Javier Andres Caceres Moreno
      Javier Andres Caceres Moreno

      good

      Author's profile photo Lars Hvam
      Lars Hvam
      Blog Post Author

      DOMA + DTEL + TABL + TTYP renaming support implemented, bug reports welcome

      Author's profile photo Oleg Bashkatov
      Oleg Bashkatov

      Hi Lars,

      a some question ahead from this renaming but still about open source:

      why you have closed project with S3 ( l mean this one https://github.com/larshp/AWS_S3_SDK_for_ABAP_Z  ).

      I found some issues and resolve them. as I understood you do not want to deal with that; is it fine if I start new/forked project ?

      Author's profile photo Lars Hvam
      Lars Hvam
      Blog Post Author

      you are free to what is mentioned in the license, note that it is GPL, https://github.com/larshp/AWS_S3_SDK_for_ABAP_Z/blob/master/LICENSE

      There is also some stuff at https://github.com/tmhew/abap-aws-s3

      But anyhow, its the wrong approach IMHO, AWS offers a lot of services, much of the client code should be auto generated via https://github.com/abap-openapi/abap-openapi-client

      Author's profile photo Oleg Bashkatov
      Oleg Bashkatov

      Thanks for the reply! and for the link to the "some stuff"

      actually I was interested why you have closed (stopped) this development ? 🙂 are you disappointed with communication ABAP-S3?) or there were some license issue?

      Author's profile photo Lars Hvam
      Lars Hvam
      Blog Post Author

      As noted in the readme, its not my development "This is a fork, original code by https://github.com/linkeit", and personally I dont really see how GPL licensed can be used in a business application, you would have to open source your full business application as GPL too.

      Author's profile photo Lars Hvam
      Lars Hvam
      Blog Post Author

      plus MSAG