Skip to Content

http://www.asugnews.com/article/sap-custom-abap-code-how-to-ensure-quality-when-outsourcing#printer-friendly css

ABAP Code Quality Survey by CAST

/wp-content/uploads/2015/07/image001_741502.jpg

The other day the American SAP Users group wanted my opinion on a new survey that came out by a group called CAST which had analysed about 70 large custom ABAP applications from organisations in the USA and Europe, and come to the conclusion that the code was a load of old baloney, ludicrous, rubbish, hopeless, fit only for the dustbin.

The clear implication was that the ABAP programmers who had written these applications could not touch their own nose, let alone write a program containing even one ounce of quality.

Nonetheless the programs worked – they solved the business problem they were created to solve.

How can this be?

Naturally it is possible to have a working program that is a “big ball of mud” – prone to break for no apparent reason, get hacked and is so complicated it is impossible for any programmer other than the creator (and often even the creator) to understand what is going on, and how to fix things /make changes.

I found the survey very interesting on the whole, some of the diagrams were utterly meaningless e.g. “changeability by industry sector” but the general meaning came through clear enough.

My first reaction is – they are right. I don’t think anybody is going to disagree, there is a lot of dodgy ABAP programming going on out there. It could be argued that the small sample of programs they used were not statistically significant but I would say that if they had analysed a thousand times more than they actually did the result would have been identical.

First off – I just want to express my despair by their use of the term “customization”. Traditionally in ERP circles the term “customizing” was used to refer to making assorted settings in the ERP system (e.g. the IMG in SAP) i.e. no code at all involved and custom programming refers to programs written by SAP customers as opposed to SAP itself. Nowadays everyone in the media using the same term to refer to both so you don’t know whether you are coming or going.

Next I notice that 70 of the 71 gigantic custom developed applications analysed were not developed in-house by the organisations being surveyed but rather outsourced. Once again that term means different things to different people but I am making the presumption that here this means that the organisations involved thought they would get their custom applications developed “on the cheap” by hiring some sort of outside organisation, be it in a low cost country or not, that would develop the application for them at the lowest price. As a result the code quality suffered terribly, that comes through from the survey very clearly. I wonder if the results would have been different if more in-house developed programs had been in the mix?

I have heard this time and again at conferences and focus groups, from managers who report the horror stories suffered by their organisation who decided to outsource development. This seems like a case of no-one every learning from history.

Since the bar at the company I work at is very high indeed, and the people I talk to on the internet (SCN) are at the top of their game it is easy to fall into the trap of thinking most ABAP programmers outside of SAP are good, but I am only dealing with a really small subset.

As an example, I am now going to look at the SCN website and see what the latest question posted on the ABAP forum is. Naturally as I write this I do not know what it is, but I do know that when I read it, it is going to make me cry.

Here I go.

I’m back. It was a question asking how to see who changed a field in a purchase order in SAP. And yes, I want to cry. That is such a basic question, and virtually all the questions are at that level – a month ago someone actually asked “is there an IF statement in the ABAP language”.

It seems to me there are thousands of people out there – going by the questions on the forum – who don’t seem to know the vey basics of programming, and yet sometimes preface their question with “I have just been appointed ABAP team leader on a major project for an international company”. Given that sort of thing going on, is it any wonder that the CAST survey uncovers a quality problem?

The CAST survey also points out that many programmers are business people who learned ABAP and thus do not know the sort of things you would learn during a computer science degree for example. This is a very true observation. I fall into that basket myself. The difference with me is that after a while (admittedly ten years) I started reading all the “classic” computer books I could (e.g. Clean Code by Robert Martin, Head First Design Patterns by Freeman & Freeman etc…) and it did make me a better programmer – that is what started me off blogging and ended up with me writing a book.

Here is a link to the actual survey itself. You have to sign your life away to look at it i.e. give your email details so you get bombarded with advertising.

http://www.castsoftware.com/advertising-campaigns/sap-crash-benchmark-report-2015—advertising—v3

On page 18 a list is given of all the quality tests that were used to gauge if the code in an application is any good or not.

I understand the vast majority of the tests that CAST applied – though some puzzle me and so I am going to ask all you people out there in SCN world for your opinions on the following quality tests suggested by CAST.

“Avoid Unreferenced Methods / Unreferenced Functions / Unreferenced Classes” – I have no idea what that means, I looked it up on the internet and it just talked about this in a Java context, implying it was a good and normal thing to do (whatever this may be). What is this, how does this relate to an ABAP context and why is it bad?

“Avoid SELECT INTO CORRESPONDING FIELDS OF” – oh dear – I use this all the time unless I am reading a massive amount of data and want every single field in the source table.

99% of the time your work area is a lot smaller than the number of columns in the database table you are reading, and there are going to be gaps between them i.e. you might want the primary key and then field 8, then field 12, then field 15.

So I thought the idea was to list of columns you wanted in the SELECT statement and do a CORRESPONDING FIELDS OF into the target area.  What’s wrong with that, why is that coming up as a quality violation?

Anyway, most of the quality tests seem very sensible tests to me, and tests that a LOT of the custom programs I have seen written would fail. E.g. the wanton cutting and pasting of code, acres of commented out code, EXITS in INCLUDES and the like.

Mind you, some of the crimes described can be found in standard SAP code itself. I would be fascinated to see what the result would be if CAST applied the exact same analysis on some large standard SAP applications written in ABAP e.g. sales order entry.

I also think SAP may outsource some development, based on the quality of code I see sometimes in OSS notes, specifically the notes that enabled the correct handling of goods receipts for purchase orders with multiple account assignment. The SAP delivered code in that case was riddled with schoolboy errors, and each note needed another note to correct it, a chain of dozens of notes, the final one saying “we give up; you will need to install an enhancement pack to fix this”.

Lastly, in outsourced companies, and in-house development, and maybe even at SAP sometimes there seems to be a very lax attitude towards code quality. If I go into an existing program to make a change and find a whole bunch of unrelated errors (unrelated to the change I am supposed to be making) I fix them. This is Robert Martins “Boy Scout Rule” – always leave the code cleaner than when you found it. In some organisations though, this is a sacking offence – i.e. making a change you were not supposed to, even if it fixes a bug or increases the quality of the code (the same sort of quality being measured in the CAST survey). Faced with that sort of attitude, are the survey results any wonder?

I apologise for waffling on, and not being as succinct as you might like, but in summary:-

·         It seems that yes there is a lot of dodgy, very poor quality ABAP code out there. I have seen it myself.

·         There is no excuse for this at all, there is so much help available on the internet

·         The survey seems to indicate that outsourced development seems to be of particularly bad quality, but since that was virtually all they surveyed that may mean nothing

As I said, I would be interested in any feedback regarding the quality tests I mentioned above, that I was unsure about.

Cheersy Cheers

Paul

To report this post you need to login first.

14 Comments

You must be Logged on to comment or reply to a post.

  1. Phillip Morgan

    I think CAST’s survey is a good assessment of the state of the art of SAP systems, although maybe a little exagerated. As you mention, they do have some very special checks that you only find in books.

    When SAP was being implemented in the eighties and nineties, (at least in my experience) there was no focus on code quality. At most, there was a worry for performance, although usually to solve an existing problem. The usual nightly report that runs for 13 hours. This kind of problem was fixed by one of us who would not just wait for the next specification to arrive but used our time to explore the system and discover all those useful transactions that helped us finetune our code to avoid said performance problems in the fist place.

    The focus on code quality to ensure maintainability, performance, and security finally arrived with the maturity of projects where abap factories and similar have been installed. But the basis of years of code done by non-developers, so-so developers, enterprising functionals, … has taken its toll. You cannot rewrite everything.

    In my present project, among other things, I audit code and demand violations be fixed before delivery. But this is only on new code, even in old programs. Nobody wants to retest everything. Nobody wants to pay for it!

    In the end, even nowadays, I think a lot of good code requirements are considered a waste of time and are not done. It is frustrating to see how many times I have to repeat myself; same violations over and over, same developer.

    Deep inside me I say “Keep calm and move to HANA”, it should all gain in speed, maybe.

    (0) 
  2. Samantak Chatterjee

    Hi Paul,

    Congrats for putting the message in a very clean and crisp manner.

    Indeed, this is a great concern and the entire developer community should pay attention to develop good quality code. Just because someone is lazy doesn’t mean he or she will write a SELECT * when only a couple of fields are actually required. Even in the age of ABAP OOPs, we still use the age old Function Modules and pay no attention to KISS principle.

    And, by the way, I have purchased your new book from SAP Press – ABAP to the Future. I’m very much interested to know about the future of ABAP and my way as a developer forward and I hope that book will guide me to choose the right path.

    Hope to see more work of beauty like this in the future also.

    Wish you all the best.

    With Regards,

    Samantak Chatterjee.

    (0) 
    1. Pablo Casamayor
      what bad code
      where everywhere
      when now
      who outsourced ones
      how ?

      i’ d love to raise another aspect of the matter:

      i guess working conditions do have an impact on the quality of code.

      How can someone learn if you do not have continuity?

      It’s high time SAP started reviewing the conditions some outsourced developers have to endure.

      Best regards.

      (0) 
  3. Praveer Sen

    Nice Blog Paul, thanks for sharing.

    Added to this..programming is a skill, it’s move person by person. Its depends how they think about writing a code and also i would like to add, it’s comes by experience.

    Some guys are having different thinking and try to provide the solution in very different and short length (less number of line) of programs and the same can be deliver by very length too by someone else πŸ˜‰ .

    I would say, After complete programs everyone should go for SCI and ABAP Test cockpit check to understand, where they have made the mistake while writing the code and correct the same.

    Happy Learning πŸ™‚

    Praveer.

    (0) 
  4. Jānis B

    “Avoid SELECT INTO CORRESPONDING FIELDS OF”

    I disagree wehemently and can’t imagine the reason this should be bad. It can’t be performance – at least not since 7.40. It can’t even be the same reasons the MOVE-CORRESPONDING “haters” claim – I can’t find the access to structure field using search by field name…

    cheers

    Janis

    (0) 
  5. Suhas Saha

    First things first – i am jealous of your writing skills 😈

    The survey seems to indicate that outsourced development seems to be of particularly bad quality, but since that was virtually all they surveyed that may mean nothing

    Tbh, i have seen both ends of the spectrum.

    1. High quality code, following good OOP principles
    2. Below par code (which made my eyes bleed) 😑

    In the former project, the architects from the client were deeply involved in the development phase. In the latter, there was hardly any involvement of the client team.

    IMHO, outsourcing isn’t bad if you have a “Big Brother” watching over you πŸ˜€

    Another thing i gripe about always are the QA reviewers of the big consulting firms. They still bask in the glory of the “parallel cursor” they had implemented 10 years ago. I called them “naming convention” reviewers instead.

    Cheers,

    Suhas

    (0) 
    1. Juwin Pallipat Thomas

      I called them “naming convention” reviewers instead.

      Absolutely loved that statement.

      Program quality: Ever changing requirements during the various phases of development…… adds to the chaos.

      Thanks,

      Juwin

      (0) 
  6. Mauricio Cruz

    I’ve lost count how many times I’ve tried to explain about Fae vs. Join (always referring to this good old thread) to people with 6+ years of ABAP. From my experience its pretty clear that some ABAPers don’t care about code quality at all because it’s not really important for their daily jobs. F_SELECT_DATA (5k lines) and F_DISPLAY_DATA(1k lines) is more than enough for most customers.

    Maybe what the survey results are saying is not just that ABAP programs are a mess, is that companies are a huge mess in the first place… Otherwise, they wouldn’t move such programs to production,

    (0) 
  7. Martin Fischer

    Hi Paul,

    Very nice blog post!

    I had a customer who used CAST for regular audits of our coding. I also remember that I had to justify some numbers which were not applicabel to ABAP in my opinion. Some of the measurements are there because CAST supports also other languages. But I did not look into details now.

    I agree with you that there are a lot of ABAP developers who care not really about QA. I’m just wondering: is that an ABAP specific problem due to the downwards compatility of the language? Are developers which work with other languages better?

    I also have the feeling, that there are only a few ABAP developers who are really interested in good software architecture. Or even worse, have absoltly never thought about transaction handling and locking. Is that only my personal impression?

    About the outsourcing discussion: here I would say it depends also on the contract. In fix priced projects I agree about that. But I also saw very bad coding from inhouse developers. The most important thing is to have a QA process. But the customers or the business unit still do not see the use in it. They do not get any functionality for this effort and do not understand what “technical debt” could cause.

    (0) 
    1. Florian Henninger

      Hi Martin,

      I’m with you. The major problem is that QA-process doesn’t end in hard facts. You know, that the code is better and because of that it doesn’t return (that often). Sadly we, the responsible persons are the only people which know that…

      Software architecture is important and I’m also sure that most of the Abap-developers know about it, but don’t get the time to use it in a good way.

      Let’s see what future brings, but I’m pretty sure all other languages does have the same problem, they just call it different.

      ~Florian

      (0) 
  8. Alejandro Bindi

    I don’t think bad quality is a consequence of outsourcing. I’ve seen LOTS of terrible in-house developments while being an external contractor (outsourced) in several companies.

    The lack of quality and attitude (e.g. fixing unrelated errors as you mention) is a problem affecting most people in this business, not just outsourced ones.

    (0) 
  9. Michelle Crapo

      It seems that yes there is a lot of dodgy, very poor quality ABAP code out there.

    Well I know some of my code was dodgy and poor quality when I started back in ’97.   It also ended up complex.   So I’m sure some of it is still around.   The excuse, if it isn’t broken, it isn’t killing the system, and doesn’t need changed.   Don’t change it.   It just takes too long, and trust me we are all very busy with projects, break/fixes, and sharing knowledge.

    That said – there is no excuse for it when writing a new program or changing a piece of code in that very old program. 😎  

    Good blog.   I downloaded CAST.   I was hoping for some more “standard” type things.  What was looked for was very basic programming challenges.

    (0) 

Leave a Reply