Skip to Content
Technical Articles
Author's profile photo Klaus Haeuptle

Clean ABAP

Having a code base, which is readable and maintainable is essential for sustainable development. The book Clean Code from Robert C. Martin and some other books contain many best practices around maintainable code.Some months ago Florian Hoffmann and me started an internal repository about best practices for maintainable and readable ABAP Code. Through info sessions with many hundreds of participants, intense discussions, and great contributions, SAP colleagues helped turn this into a treasure trove for modern ABAPers.
From the exchange with customer and partners, we know that there is a huge need for such kind of best practices. Besides, many of you asked whether this would become available as a book, and whether we would be allowed to share it with our customers and partners. We came to the conclusion that this initiative gains its drive from its community, and that it needs to remain part of that community.
Therefore, as of now, Clean ABAP is an Open Source contribution:

Under the CC BY 3.0 license and open to contributions from inside and outside of SAP, we hope that this repository will help developers worldwide to make their ABAP code a little cleaner, day by day.


Based on the ask from many colleagues, we are additionally publishing a book clean ABAP to help developers with learning and implementing clean ABAP as an individual, as a team and as an organization.

Besides, there has been a podcast published recently. More details can also be found behind the following links :

Assigned Tags

      44 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Mike Pokraka
      Mike Pokraka

      As a big fan of clean code principles, I can only say this is a wonderful initiative. Thanks for making it public!

      It's amazing how difficult it is to convince people to write easily readable code, this will help.

      Author's profile photo Lars Hvam
      Lars Hvam

      Great reading, thanks for sharing

      Author's profile photo Jeff Carty
      Jeff Carty

      This is pretty great, amazing work!

      Author's profile photo Nabheet Madan
      Nabheet Madan

      Great stuff!

      Author's profile photo Bruno Alves
      Bruno Alves

      Awesome, thanks for sharing,

      Author's profile photo Johann Fößleitner
      Johann Fößleitner

      Excellent job! Thanks for sharing this great stuff with the community. Every ABAP developer should know and use Clean Code. This makes the ABAP world a bit better for all of us.

      Author's profile photo Mattias Johansson
      Mattias Johansson

      Great, there's a great need (I would almost say desperate) for this, will definitely share it with my team. I did put the Clean Coder book in our bookshelf, no one has touched it 🙂

      Author's profile photo Sai Krishna Kowluri
      Sai Krishna Kowluri

      Thank You Klaus Haeuptle and Florian Hofmannfor this great initiative.

      Author's profile photo Abdul Hakim Sulaiman Batcha
      Abdul Hakim Sulaiman Batcha

      Great Stuff!!

      Author's profile photo Søren Amdi Bach
      Søren Amdi Bach

      This is a great and usefull initiative!

      Author's profile photo Chairat (Par) Onyaem
      Chairat (Par) Onyaem

      I love to see ABAP to support method name longer 30 characters.

      Author's profile photo Uwe Fetzer
      Uwe Fetzer

      Every training I give starts with the chapter "Clean Code". With the "new" ABAP it's so easy to implement, but a bit hard to teach (like the use of Eclipse).

      Thank you for this initiative.

      Author's profile photo B. Meijs
      B. Meijs

      This is so recognizable.

      Author's profile photo Alejandro Jacard Plubins
      Alejandro Jacard Plubins

      Bookmarked in the section "important", thanks for an awesome contribution.

      Author's profile photo Matthew Billingham
      Matthew Billingham

      I've spotted stuff that I'm doing right... and stuff I do that maybe I'll think about changing!

      Author's profile photo Former Member
      Former Member

      This is really a fantastic initiative...Thanks for sharing the great things for ABAPers...kudos Klaus

      Author's profile photo Julian Phillips
      Julian Phillips

      I really appreciate a blog on this topic, coding best practices in ABAP has been neglected for far too long! We can sure make use of this where I work, looks like I have some reading to do though!

      Author's profile photo Michelle Crapo
      Michelle Crapo

      Just amazing!  Awesome blog – great initiative.

      Jelena Perfiljeva Paul Hardy  

      Author's profile photo Paul Hardy
      Paul Hardy

      I have been reading this online document the last few days. Lars Hvam told me about it in Copenhagen over the weekend.

      I don't think any programmer will ever agree with 100% of it, but the vast majority makes a lot of sense to me.

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      In my experience, there is never 100% agreement among programmers on anything. 🙂

      Author's profile photo Tomas Buryanek
      Tomas Buryanek

      We can agree on that 🙂

      Author's profile photo Florian Hoffmann
      Florian Hoffmann

      I disagree. 😉

      Author's profile photo Bärbel Winkler
      Bärbel Winkler

      Thanks for putting this together! I'm just scratching the surface at the moment, poking around a bit here and there and already found lots of stuff we should (perhaps) do differently. Not too suprisingly, I also happened upon several items which fly right over my head as I just don't do much programming (and then just a little bit with OO) nowadays.

      Definitely lots of food for thought to digest and then share with others!

      Cheers

      Bärbel

      Author's profile photo Carlos Alberto Valentini
      Carlos Alberto Valentini

      Good Morning.
      Excellent news

      Author's profile photo Christopher Solomon
      Christopher Solomon

      VERY nice! Good to see something "new" finally come out after seeing the same old style/standards guide from back in the 1990s still making the rounds! haha

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      Some books should come with self-destruction mechanism. 🙂

      ABAP guidelines were published back in 2009 by SAP Press though, but I find even those would still be novelty to some developers.

      Author's profile photo Mike Pokraka
      Mike Pokraka

      Correction: ARE a novelty to MANY developers, even whole organisations.

      Even though everything in that book is also in the ABAP online documentation.

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      Personally, I find the whole “Uncle Bob” cult following annoying and, by association, dislike the words “Clean Code”.

      But I am a big fan of the streamlined and optimized code (I just simply call it “code” ? ) and this is really an excellent initiative! I like the “cheat sheets” a lot, this is very handy. And the fact that this is available on Git and not as a $60 book – this is just fantastic. Well done and thank you for sharing!

      Well deserved title of probably the most liked and commented SCN blog of 2019. ?

      Author's profile photo jyothir aditya k
      jyothir aditya k

      Very good content !

       

      Thanks!

      Author's profile photo Elias Kekakos
      Elias Kekakos

      Just Wonderful.

      Thanks a lot.

      Elias

      Author's profile photo jyothir aditya k
      jyothir aditya k

      very nice article !

      Author's profile photo Nawanandana Edirisinghe
      Nawanandana Edirisinghe

      Thank you for this initiative, its way to go

      Author's profile photo Oleg Bashkatov
      Oleg Bashkatov

      Thanks for the blog

      In Correctness and Quality of ABAP help they say: that as a good practice to run not only unit tests but scenario tests also. You have mentioned nothing about scenario tests for ABAP-environment.

      However still for now in fact the scenario testing is important testing.

      Do you need such kind of “drive from … community” about automation scenario testing in ABAP-development ? )

       

      Author's profile photo Joao Sousa
      Joao Sousa

      “We encourage you to get rid of all encoding prefixes.”

      From my exprerience that wlll be one of the hardest! ABAPers do like their prefixes.

      Edit: After reading it all, I just have to congratulate you guys on a job well done. I'm going to apply this for all this greencode because I agree with like everything and the examples "Do" and "Don't" give an excelent picture. Unfortunately most of the code you see today uses the "don't" examples. 

      Author's profile photo Loyd Enochs
      Loyd Enochs

      Excellent work!

      Lots of topics to evaluate and discuss, particularly for those of us on older versions.

      Author's profile photo Joachim Rees
      Joachim Rees

      I was made aware of the Github link via the Fediverse some time ago and now also found this blog.
      Very nice, I like it a lot!

      best
      Joachim

      Author's profile photo Pramod Repaka
      Pramod Repaka

      It is so nice to see how SAP is evolving and always up to the market and sometimes even ahead. Thank you Klaus Haeuptle for this blog.

      Author's profile photo Praveer Sen
      Praveer Sen

      Thanks for sharing Klaus Haeuptle

      Praveer.

      Author's profile photo Joachim Rees
      Joachim Rees

      Interesting to see this blog still featured on the community front page - in as 'most liked' and 'trending'

       

      ...shouldn't there be some kind of cap, maybe?! OK for it to be "most liked" for as long as that's the case - the metrics are easy here (just count + compare likes).

      But if something is trending for about a year already? What exactly is the metric here?

      Author's profile photo Tuna CENGİZKANER
      Tuna CENGİZKANER

      Thanks to all contributers for this amazing work!

      Author's profile photo Matthew Billingham
      Matthew Billingham

      A contrary view: It's probably time to stop recommending Clean Code

      (Same web site contains 3 really innovative and mind-blowing hard science-fiction novels!).

      Author's profile photo Jibin George Mathews
      Jibin George Mathews

      Good one.

      Author's profile photo Rüdiger Hodapp
      Rüdiger Hodapp

      Thanks for this styleguide!

      Every SAP Developer should read this guide.

      I am wondering when SAP itself will write clean code. I just had a look at the central function module of material requirement planning. Even the name violates clean principles "DO_DISPOSITIONSRECHNUNG" 🙂 When will SAP stop with "Denglish"

      If you look into the code of DO_DISPOSITIONSRECHNUNG nearly every line of code is against the  principles.

       

       

       

       

       

       

      Author's profile photo Robert Forster
      Robert Forster

      Rüdiger Hodapp  If Time_Machine invented.

      Time_Machine->GoBackinTimeAndAlterCode( fm = DO_DISPOSITIONSRECHNUNG  style = CleanCode years = 25 ). endif.