Of late I have been doing lot’s of debugging and during such time I have come across some, how shall I put it, interesting code.
On a couple of occasions I posted screen shots of the offending code on Twitter. One of my fellow Twitterers, who is a legend in his own right, Thorsten Franz (https://wiki.sdn.sap.com/wiki/display/profile/Thorsten+Franz), Tweeted back and said I should Blog about this so that is exactly what I am doing.
I expect that this blog will stir some memories in others and get them to share their experiences with interesting code.
I suspect I will end up moving this Blog to a Wiki to allow others to update it and add their stories
From what I have found so far it’s clear that most of the developers have neither had any formal training in ABAP programming or have either read books or spoken to other developers who are living in the past and don’t give a damn about a programs performance. They just make it work regardless of how it looks under the bonnet.
For me there are some rules that I stick to when writting a program, these are:
1) It works, well Duh!
2) Perfomance is optimal.
3) The code is easy to read and the logic is easy to follow.
4) Use the latest methodologies where applicable.
The “Interesting” Code
Right, here are a few of the clangers that I have discovered so far.
Here the developer is clearly paranoid about making sure the data is passed to l_ekko.
Here, it appears that no one other than the mentioned users are allowed to execute this code. This is SAP standard BTW.
Ok, here the developer has an issue with clearing the work area and internal table. I love the fact that he clears the table even though the table and work area are declared just prior to them being cleared.
And just in case they weren’t cleared in the previous two attempts the developer clears them another couple of times for good luck! Good on ya Mr Developer.
Here we have a developer who hasn’t quite understood the user of move-correspnding.
This is the type declaration for the internal table.
This is the data select into the internal table.
For this next piece of code I don’t actually have words to describe my thoughts on it. It makes me want to cry.
again, the same developer from above example.
Well, that’s just a few examples of what I have come across so far.
I think it would be a good idea to create a WIKI of horror code depending on the feedback I get from this blog. Hopefully I won’t have offended to many people. My intention was just to share some interesting code.