Skip to Content
avatar image

Share your "ABAP gore"

There is a sub on Reddit called Techsupport gore where people share pictures and stories of some horrific things they see done with technology.

I've been looking at some old programs lately and see lots of stuff that would qualify as "ABAP gore". :) So I thought it might be therapeutic and educational to post some examples on SCN (examples to follow in the comments).

* Please Login or Register to Comment on or Follow discussions.


  • Apr 23, 2018 at 05:50 PM

    "Oh well, I hope these comments compensate for my non-descriptive variable names":

    scn.jpg (17.7 kB)
    • Apr 25, 2018 at 02:14 PM
      Looks like you kind of gave up at "Printer speed" and especially "Speed type".

      And I just love how - out of nowhere - there is "v_brand". Did someone else add that one? :D

      • Apr 25, 2018 at 02:34 PM

        LOL. I thought so too but it seems to be from the same version. It looks as if the person doing this was either under influence or had some health problem and were sort of going in and out of conscious state. They misspelled "processor" in the 2nd line, then copy-pasted "printer speed" then suddenly woke up: "huh? what just happened? where am I? v_b... BRAND! BRAND!".

        Also "speed type" reminded me of Spaceballs: "ludicrous speed". Good times. :)

    • Apr 30, 2018 at 08:13 PM

      The Zodiac killer strikes again!

      I'm wondering if they meant "monitor" instead of "screen" but then forgot the word. Or, considering this is written around 2000, maybe they thought end of days is coming or something.

      scn.jpg (20.0 kB)
  • Apr 23, 2018 at 05:53 PM

    For the bonus points: these are not actually used anywhere in the program but even before they were commented out they were used exactly one time.

    scn2.jpg (18.5 kB)
    • Apr 24, 2018 at 10:08 AM

      Actually, I can relate to this: rules say "never use a literal, always use a constant instead".

      For long years, in nearly every report, I (and I think others as well) define

      gc_x type c value 'X'.

      ...until at some point, I realizes I could now just use abap_true instead.

      • Apr 24, 2018 at 03:05 PM

        That rule makes sense only if the constant is named properly. E.g. just the other day I had to look up VBFA with J (=delivery) document type. So I created c_delivery constant. Even though I used it once, this made the code more clear, I believe.

        Also I take your gc_x and raise you gc_space. Apparently no one have heard about the space variable either. :)

    • May 01, 2018 at 10:17 AM

      This is a classic, I've seen it so often in previous engagements. It was often the result of blind adherence to programming standards, where either or both of these conditions existed:

      - the programming standards weren't good enough to explain when and when not to use which rules

      - the adherence was applied with a complete lack of common sense

      What was worse was that in some cases the constants like this had been edited, so you ended up with something like this (see arrow)!

        c_10(2) value '10',
        c_20(2) value '25',      <---- !
        c_30(2) value '30',
  • Apr 24, 2018 at 08:16 AM

    Why use the correct company code in FBL3N BTE? Just read the first thing you find (and i do not want to speak about how it has been written)

    no-bukrs.png (16.5 kB)
    • Apr 24, 2018 at 03:08 PM

      Haha, who cares about the company code!

      I also love SELECT from language specific table but without specifying a language. Sure, it works fine when you have just one language in the system but then the big bosses decide to open an outfit in Mexico and suddenly a customer in Ohio gets an invoice with Spanish descriptions. :)

      • Apr 26, 2018 at 07:01 AM

        Oh, sadly i already fixed those, but i found in the same BTE those kind of checks.

    • May 03, 2018 at 12:13 PM

      I have seen variants like this. Why read random first, when you can read random last :D ;-(

      SELECT * FROM knb1 into wa_knb1 WHERE kunnr = i_kunnr.
      IF sy-subrc = 0.
        "do something with wa_knb1...
      • May 03, 2018 at 12:17 PM

        Well, when i was young, blonde, rebel and handsome, i found a code like this from the collegue who should to unveil me the mysteries of ABAP

        SELECT * FROM <table> WHERE <condition>.
        CHECK sy-subrc = 0.
        <do stuff>
  • Apr 24, 2018 at 08:18 AM

    And one of my fav, same BTE

    if.png (10.3 kB)
  • Apr 28, 2018 at 06:49 AM

    Doubtless many have seen countless of these:

    IF sy-subrc <> 0. 


    CATCH cx_root.
    • Apr 30, 2018 at 02:33 PM

      Not even "todo", just "Implement suitable error handling..." or whatever text comes when you use the Pattern button.

      • Apr 30, 2018 at 04:24 PM

        Dunno, to me an old todo is worse. A "todo" comment means someone has engaged brain and decided this is a valid gap. Many a bug has been traced to one of these.

  • Apr 28, 2018 at 06:51 AM

    One of my all-time favourites:

    METHOD return_sy_datum.
      data: lv_date type sy-datum. 
      lv_date = sy-datum. 
      rv_date = lv_date. 
  • Apr 30, 2018 at 02:38 PM

    ABAP equivalent of "Honey, the cat threw up again! I'll just put a paper towel here. Gotta run, bye-e!" :)

    scn.jpg (24.3 kB)
    • May 03, 2018 at 12:21 PM

      Oh no, the "we don't have Materials in this format" is a clear hint of a nice practice of COPY-AND-PASTE a code from another customer's system and then... forget!

      Like a test on a company code not even in the system...

  • May 02, 2018 at 09:24 AM

    A "simple" method named "START_OF_SELECTION" with just 366 rows of code and thise structure.
    The method is defined in a Global Class, used in just one report, report which is used to create the selection screen and pass to this class the select options.
    Someone needs to learn how to use OOP and to structure code....

    Oh, wait!
    It's the same person, our consultants' technical reference, saying that "Code's quality is matter of opinion, there is no strict rule" when i started to reject their code (Sadly i'm finding these monsters here and there)

    why-me.png (10.7 kB)
    • May 02, 2018 at 08:36 PM

      They must have gone to the same ABAP school as our former consultants. :( Some kind of a nested IF addiction is sweeping the nation. I don't have the screenshots anymore but used to see up to 10 nested IFs in some places. How would you even read your own code? That's what I don't understand...

      Gotta love massive CLEAR list too. This is just a tip of the iceberg, there are 8 of those "prodsets", takes full screen on my laptop:

      scn.jpg (21.2 kB)
    • May 25, 2018 at 11:48 AM

      "It's the same person, our consultants' technical reference, saying that "Code's quality is matter of opinion, there is no strict rule" when i started to reject their code (Sadly i'm finding these monsters here and there)"

      Of course it's a matter of opinion. And I'm of the opinion that if you don't fix it, that the carpark is awfully dark. It would be awful if an accident were to happen.

  • May 02, 2018 at 12:17 PM

    We are at the 14th! level of nested structure in a more than 1000 lines long SD user-exit. This coding passage repeated around 5 times. By the way, not a single line of comment.

    And they asked to fix the problem quickly... :D

    exit.jpg (109.4 kB)
    • May 02, 2018 at 01:10 PM

      We share the pain!
      (perfect meme follows)

      2018-05-02.png (343.4 kB)
    • May 02, 2018 at 08:49 PM

      Could be one of those cases when a functional spec is translated into code quite literally. Once we had a consultant write a user exit and the spec had several steps like "check this condition... if so, do X". All those steps were performed with the entries in an internal table (the spec did not go into the implementation details). But instead of using a LOOP, the consultant literally put a bunch of READ... IF... there.

      P.S. Wait, are they actually updating document flow (VBFA) in that user exit? 8-[ ]

  • May 03, 2018 at 12:31 PM

    Space catalog anyone?

    screen.png (26.6 kB)
    • May 03, 2018 at 02:32 PM

      Reminds me of colleagues that use "space" instead of "tab" in Word to structure texts. *shudders*

    • May 03, 2018 at 03:37 PM

      Yep, again same ABAP school as our former consultants. I suspect there is a copy of an ALV report that just gets passed from one consultant to another since 2000 and they all feel this is bees knees.

  • May 07, 2018 at 08:07 PM

    Declare a dozen of useless variables but then write into an sy-... one? Well, it's there, so might as well use it, why not:

    scn.jpg (16.0 kB)
  • May 07, 2018 at 08:10 PM

    From the "mildly infuriating" department. :)

    scn.jpg (23.3 kB)
  • May 10, 2018 at 10:09 AM

    Not sure whether it qualifies as 'ABAP gore' but here it goes.

    A functional consultant asked me to check a custom-made report as it didn't work as supposed: a dozen radion buttons on the selection screen didn't give the expected result.

    Turned out not one single radio button was processed in the report!!!

    In the end i had to rewrite the report. :(

    • May 14, 2018 at 06:33 PM

      Classic! Haha! :) Have to admit I've been guilty of writing all the code for the buttons but then forgetting to actually call it. :) This was caught in QA though, fortunately.

  • May 15, 2018 at 04:03 PM

    Wondering if this was written on a dare to use every possible way of variable declaration (pre-7.4) in one structure. Readability be damned.

    scn.jpg (14.5 kB)
    • May 16, 2018 at 08:31 AM

      but it does give a summary of the field declaration... so at least the name of the internal table is well chosen :)

  • May 16, 2018 at 09:21 AM

    I don't even want to talk of the code itself.

    capture.png (28.6 kB)
  • May 18, 2018 at 08:01 AM

    Me: Dear consultant-that-i-pay-too-much, i cannot see the required OSS Note installed on our system.

    C-T-I-P-T-M : Oh the note has just manual operations, so i applied them without installing the note: should i install the note and mark as done?

    Me: have you any other idea than that to keep track of which note is installed in our system otherwise?

    C-T-I-P-T-M : i installed the note

  • May 23, 2018 at 08:07 PM

    Can you help me? I don't understand why i'm getting a dump.

      IF e_cabecera-persl IS NOT INITIAL.
        t_detalle-persl = e_cabecera-persl.
        MODIFY t_detalle TRANSPORTING persl
         WHERE persl IS INITIAL
            OR persl IS NOT INITIAL.
  • May 25, 2018 at 11:52 AM

    This discussion is not good for my blood pressure...

  • May 25, 2018 at 04:41 PM

    Warning: this one may be dangerous for people with heart conditions. :)

    Let me set the stage for you here. I'm looking at a 20k line program. The author defined variable L_RC (type I) in a routine (a SY-SUBRCesque flag). They are then calling multiple other subroutines with USING l_rc and are actually changing l_rc (same name everywhere too) in those subroutines.

    This is the second hour of me going down the rabbit hole and I haven't hit the bottom yet. It is already 4 or 5 subroutines down and keeps going. If I don't make it out alive - it was nice knowing y'all!

    scn.jpg (41.3 kB)
    • Jun 12, 2018 at 09:38 AM

      Well those 'class', 'method' and 'exception' thingies are way too modern anyway :-P

  • Jun 01, 2018 at 04:04 PM

    "Constants defined, boss!"

    scn.jpg (19.3 kB)
  • Jun 08, 2018 at 07:10 AM

    Arrghh ... This is the first thing i see here in the morning! Pure evil this! :D

  • Jun 12, 2018 at 07:02 PM

    "No idea what I'm doing here but one of these should do the trick, I guess."

    scn.jpg (12.3 kB)
    • Jun 15, 2018 at 03:07 PM

      To be sure to be sure!.

      And just in case it doesn't work I'll add a comment so people know what I want, what I really really want.

  • Jun 15, 2018 at 06:32 AM

    Not Optimal

    endselect.jpg (37.6 kB)
  • Jun 16, 2018 at 04:42 AM

    You know how you shouldn't use INCLUDEs for modularisation. And you shouldn't use Macros?

    Just found an include that's included in multiple methods in multiple classes, which contains 3 complex macros. And in most of the methods where the include is included don't even use the macros.

  • Jun 18, 2018 at 09:12 AM

    Fine example of comments telling lies. Message 366 does start with the word "warning" I will grant you that. I also like the variable that has SH for ship-to and AG for customer in it. A fine mix of English and German abbreivations.

  • Jun 28, 2018 at 02:24 PM

    At first, every line is narrated in the comments:

    But then out of the blue stuff like this starts and there is not a single comment, no documentation and no explanation of what's the significance of those values:

    Face palm.

    scn.jpg (34.9 kB)
    scn1.jpg (35.5 kB)
  • Jul 03, 2018 at 01:25 PM

    Please, focus on WA_SSOZ: is it just me seeing a little problem with a possible endless loop?

    Performances are another issue but, well, in this case it's the last of the problem

    And i wonder if RANGE_DATA will work this way.... something i doubt.

    1.png (28.9 kB)
    2.png (19.5 kB)
  • Jul 03, 2018 at 01:27 PM

    Not happy about the previous post,in 8 lines find the 2 monster errors

    image.png (19.2 kB)
    image.png (19.2 kB)
    • Jul 03, 2018 at 04:17 PM

      That just doesn't make any sense... "Oh, I didn't find the company address, so lemme just grab a random one" ?

      Someone had too much wine with lunch, I think. :)

      • Jul 04, 2018 at 06:31 AM

        And notice that P_BUKRS is a select option so, even if i find a company address, it's one over N!

        • Jul 04, 2018 at 09:06 AM

          Well, at least it is a valid address for someone ;-)

          That point must have been for sure in the specifications....

  • Jul 10, 2018 at 02:54 PM

    "Since I assigned 0 above..... Do not check Return". Ugh.

    scn.jpg (20.5 kB)
    • Aug 28, 2018 at 01:15 PM

      The irony is that the commentary is more typing than a simple if sy-subrc ... l_apc = 0.

  • Jul 11, 2018 at 06:23 PM

    Forget about the fact that we are still using SAPScript in 2018 but there are 3 pages of this stuff for what looks like half of the alphabet:

    scn.jpg (44.8 kB)
    • Jul 12, 2018 at 07:04 AM

      Just a note: SAP doesn't provide smartforms for everything.

      Last example i worked on is the cheques' print and, in my 731, i have only sapscript

      • Jul 23, 2018 at 07:21 PM

        Yes, you're right. SAP loves to yell at us to use new tech but then they just don't offer it. :) FI module is notoriously underserved by Smart Forms or PDFs. Finding SAPScripts in SD is quite surprising though


  • Jul 30, 2018 at 01:09 PM

    OK, this isn't exactly 'ABAP gore' but it's too danged good not to share.

    I'm system debugging this morning, and oh dear lord, YAWN, but then I see this:

    Blessings upon the person who wrote it. REALLY MEAN IT.

    • Jul 30, 2018 at 03:18 PM

      So what was your next step? (Just in case you are still able to tell us...:))

      • Jul 30, 2018 at 03:23 PM

        I was so excited about the comment, I forgot to keep stepping and the debugger timed out. Read into that what you will :-)

  • Aug 02, 2018 at 11:53 AM

    I saw a short dump (TIME_OUT) in production and found this wonderful code.

    There are forty one such blocks looping over GT_TABLE2 looking for one record. GT_TABLE and GT_TABLE2 both have 50,000 records. Both are STANDARD tables. Why in the world is it timing out?

    I also think it is best practice to use names like GT_TABLE for your internal tables, just to make it obvious what sort of data the table contains. The upper/lower case formatting is pretty good as well.

  • Aug 08, 2018 at 10:22 AM

    I'm sharing this piece of code (found in LVEDBF4R due to a recent dump it caused with an incoming IDOC) not because it's typical "ABAP gore" but out of frustration regarding the back-and-forth I'm currently having via an OSS-message to possibly get it fixed by SAP (they want to close my message because the issue is no longer reproducible as we already corrected the IDOC causing it):

    *- proof the length of the order number -------------------------------*
       condense e1edk02-belnr.
       if e1edk02-belnr+10(1) ne space.
        xvbak-vbeln = '0000000000'.
     *- Auftragsnummer -----------------------------------------------------*
     *- order number -------------------------------------------------------*
                  INPUT   =  E1EDK02-BELNR
                  OUTPUT  =  XVBAK-VBELN
                  OTHERS  = 1.

    Unless I'm missing something - always a possibility - this should be quite easy to fix, shouldn't it, to actually work in more cases than the current rather limited one?

    The problematic content of field E1EDK02-BELNR was something like this "08.08.2018 some more text" when the conversion exit dumped.

    Update: shortly after posting this here, my OSS-message was forwarded to the development team. :-)

  • Aug 15, 2018 at 03:18 AM

    I like comments ...

    Found in SAP standard code, explaining how they work out what tz database values match a given Netweaver (SU01 style) timezone, prior to transfer to success factors.

    Unfortunately the code underneath, while very clean and not deserving of being mentioned here, doesn't cope well with Australian time zones. Then again, sometimes neither do I.

  • Aug 30, 2018 at 08:30 PM

    ABAP cover of Lady Gaga's Bad romance. "Rah rah ah-ah-ah!" :)

    scn.jpg (18.3 kB)
  • Sep 07, 2018 at 06:37 PM

    Going through an old program and finding this type of stuff in multiple (!) places:

    Why, oh why...

    scn.jpg (13.5 kB)
    • Dec 17, 2018 at 01:06 PM


      It shows that you have given some thought to your code logic. (supposedly), however, that breaks the 'put the most taken condition first' rule, and sits along side the 'mention all cases' rule (see thought.....) for increasing your line count per month.....


      • May 21 at 04:33 PM

        I did it sometimes. Shame on me, but I did it. Why? To make clear I DO NOT CARE IF IT FAILED!!!

        Let's say these are "enhancement spots": if you want to do something, do it yourself, I don't care because it does not affect the program flow.

        Shame on me.

        I had bad moments with the QA team in an old place I used to work. I used to add comments like

        "I really do not care which register it returns, because all are the same"

        after a SELECT without a "proper" ORDER BY clause. Sadly, some guy made me rewrote my code because he wrote some other programs where the ORDER BY was necessary and it failed after move to HANA DB.

  • Oct 15, 2018 at 05:19 PM

    FM does have the exception defined with the name OTHER. FM code has just a few lines (if you don't count 2 pages of useless comments :) ) and never raises any exceptions whatsoever.


    Wondering if Extended Check did not exist in 2000 yet...

    scn.jpg (36.0 kB)
  • Oct 15, 2018 at 07:13 PM

    I love trying to change code that has been copied from a query and then changed. And don't miss my addition of the "order type"

    qery.jpg (51.3 kB)
  • Oct 16, 2018 at 08:44 AM

    If you really want to lose the will to live, have a look at standard SAP INCLUDE program RVDIREKT...

    • Oct 16, 2018 at 11:52 AM

      Jesus Christ almighty..... (ಠ_ಠ)

      It's over. You win, Paul...


    • Oct 16, 2018 at 02:34 PM

      wow... just wow.

      This thing is all over the place.You'll see c_obj_type_salesorder LIKE swotobjid-objtype VALUE 'BUS2032', but also bus_2032(7) VALUE 'BUS2032'

    • Oct 16, 2018 at 04:32 PM

      Okay, I went to look at that include. I stopped reading on line 54.

  • Oct 16, 2018 at 02:18 PM

    Hmm, is it not no or should it be yes? And what happens if it's a maybe? Questions upon questions...

    This definition within the same program is also quite interesting.

    • Oct 16, 2018 at 04:12 PM

      My understanding is that a lot of programmers write


      rather than


      beacuse that was the way you were forced to code it before version 4.0 of SAP in 1998.

      Another possibility is that they do this because they like to sound like Yoda.

      • Oct 16, 2018 at 06:35 PM

        IF NOT SOMETHING IS INITIAL style is driving me nuts. Especially if it's

        IF NOT sy-subrc IS INITIAL.
        <do stuff>
        <do other stuff>

        Well, if you use both then just start with a positive condition.

        P.S. I do not understand the way this website formats the code...

        • Oct 16, 2018 at 07:51 PM

          The only way to paste code is: first press code button then insert code in the gray line.

      • Dec 07, 2018 at 04:43 PM

        Paul, IF NOT was how I learned it back in the Dark Ages and it has taken me a while to wean myself from that habit.

        I have seen IF NOT <field> IS INITIAL [do stuff] ELSE [do other stuff] used to comply with coding standards that dictate the most common occurrence be the first leg of the conditional for performance reasons.

        Sadly, those organizations didn't mind SELECT * (but, it is in the SAP class materials.........)

        plus ça change, plus c'est la même chose

  • Dec 07, 2018 at 03:25 PM

    Just when I thought I saw everything, I came across a program where the author added space before every comma and dot. Why oh why...

    scn.jpg (38.7 kB)
    scn2.jpg (9.7 kB)
  • Dec 13, 2018 at 03:54 PM


    scn.png (10.4 kB)
  • Dec 13, 2018 at 04:40 PM

    The ****** who edited one of my programs, but couldn't be bothered to pretty print it. Most discourteous.

  • Dec 17, 2018 at 01:11 PM

    Here is all the gore you could ever want (and it's all SAP related)......

    As an example.... an extract:

    *... send a cute message while the sand glass is running. 
    *... The user should not die of boredom when response times are bad. 


    • Dec 17, 2018 at 07:22 PM

      funny, funny stuff ! I especially love the function module exception 'crap_input' and "RAISING s***_happened".

      thanks for sharing !

  • Dec 26, 2018 at 02:55 PM





    ififififiififif.jpg (121.6 kB)
  • Jan 14 at 06:08 AM

    I checked the old programs and found this :)

    abapgore.jpg (8.1 kB)
  • Jan 14 at 08:59 PM

    [Voice of an HGTV show host] Important comment is spray-painted to breath new life into the old ABAP command. And asterisks in an empty line add pizazz to the otherwise boring report. :)

    scn.jpg (16.1 kB)
  • Jan 17 at 07:47 AM

    7.50 program developed in the last 3 months.

      PERFORM checks.
    FORM checks.
    ...more then 4000 lines later.
    • Jan 18 at 07:09 PM

      Hm, it's odd they missed a chance to create lcl_checks with one 4000 line method main() and then claim "ABAP OOP experience" on the resume. :)

      • Jan 20 at 09:09 AM

        Oh, that can be done, because the program uses an ALV and has some local event handlers... sadly defined in the wrong place of the Function Module...

      • Jan 23 at 01:27 PM

        Shhhht... i saw that, i totally saw that and I still have nightmares.

  • Feb 08 at 04:24 PM

    ABAP rant. :) Funny thing: this is most likely written by a person who hasn't learned anything new since 1980s, judging by his own code.

    scn.jpg (38.8 kB)
  • Feb 08 at 07:46 PM

    "...aaaand once again for the cheap seats!" :) It's already cleared but just to be completely sure let's put spaces there. (Internal table with header line, of course.)

    scn.jpg (32.5 kB)
    • Feb 11 at 01:52 PM

      Jelena, it is either the "braces and belt" programming method or the "just in case the computer didn't hear me the first time........." coding paradigm. :)

      (Or the American tourist overseas who just says the same thing again only slower when the non-English speaker doesn't understand.)

      • Feb 11 at 04:44 PM

        Or you forgot the English man abroad speaking to the non-english speaker------ he thinks the louder you shout the easier it is to understand.....

        btw... BELT AND BRACES...... you understand ????? I SAID BELT AND BRACES NOT BRACES AND BELT!!!! :-)

  • Feb 25 at 01:46 PM

    The programmer failed choosing his profession - should be a storyteller instead

    selection.jpg (123.6 kB)
    • Feb 25 at 04:56 PM

      Hm, not sure I'd like to read a story of this writer, either... – just imagine all the explicit hints to what details of the story are relevant ("hey, don't overlook them!")..:)

    • Feb 25 at 05:46 PM

      Some major checkbox addiction there. :)

      • Mar 22 at 02:49 PM

        Especially considering the middle bit. Translation of

        "von den folgenden Funktionen n u r e i n e: ..."

        "from the following functions o n l y o n e: 1 or 2 or 3"

        I hear there are them newfangly things called radiobuttons...

        • Mar 22 at 05:31 PM

          Yep, that dialog must have been designed long before broadcast was established in Germany:)

          I also like those hints "Ohne Anklicken geht nichts !""Without checking [the box] nothing will happen !"

          Guess it would be quite funny to test the overall behaviour (unless one has to support that application, apparently...).

  • Mar 04 at 01:00 PM

    Here is my one for today.

    • Mar 04 at 07:42 PM

      And I bet later in the code there is MESSAGE Z1(999) WITH lv_symsgv and in SE91 the message is maintained as "& & & &". :)

      • Mar 05 at 07:01 AM

        Funny you should say that....

        • Mar 05 at 08:50 AM

          So I have to assume Jelena wrote that err knows that code? :)

          • Mar 05 at 03:06 PM

            Well, I've seen very similar things in SAP systems I worked with. I bet the origins of all such code can be traced back to a single source. Someone must have started it and others just copied. It's like a virus. :)

            • Mar 05 at 04:18 PM

              I wouldn't be surprised to discover the origin in some obscure "Best Practice" lost in the mists of past ages and secretly passed from consultant to consultant, like an elitist rite to capture the customers' souls!

  • Mar 22 at 06:36 AM

    Found by Bärbel Winkler


    if sy-msgid is not initial and sy-msgno is not initial.
       message id sy-msgid type 'E' number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
             raising badi_execution_failure.
       message e653(tk) raising badi_execution_failure.

    '000' is a valid SY-MSGNO. '000' = INITIAL.


  • Apr 11 at 09:11 PM

    This is the first time I'm seeing such warning. Quite amazing EC actually checks for this specifically. I guess it happens more frequently than I want to believe. :)

    scn.jpg (51.7 kB)
  • Apr 16 at 06:28 AM

    Here is a lovely combination of hard coding and fragility. The GCR_SHOW_PRICE is filled from a customising table, and the third entry in that table is value N000.

    So if someone changes the customising they have no idea the program will break.

    And if the read fails, I presume the VBKD-ZTERM will be blanked out.

    Also if you wanted to change the payment term to something other than N000 then the name of the routine would be even more nonsensical than it is at the moment.

    • Apr 16 at 08:41 AM

      I read/imagined the name of the attachment/pic with the voice of Darth Vader... so thanks for that. :D

    • Apr 29 at 05:23 PM

      This is the ABAP equivalent of setting up a mine and carefully covering it with grass and leaves. Lord help the person who trips the wire...

  • Apr 16 at 08:01 AM

    Not pure coding, but I just lost the few hair still covered my head hearing a collegue's answer when I kindly suggested he should start using OOP and organizing code instead of just throwing it down for 2000 rows.

    Oh, now it's important it works, then i'll fix and organize it...
    • Apr 16 at 06:32 PM

      No time to do it right, but plenty of time to go back and change it later - gotta love it. And how do we explain this new transport after it had been through test and delivery?

      Of course your colleague is keeping track of all these items to go back and correct.

      Or not - which is FAR more likely, of course.

    • Apr 29 at 05:21 PM

      Even without OOP the code can be greatly improved just by using descriptive (and accurate!) names. I had to spend like a week on one jumbo program recently that was worked on by several developers before. The first person obviously was like that colleague: I'll just make it run and "let God sort them out".

      Then apparently every new developer went in and was like "heck, I can't understand this but I know I need to add <X>, so I'll just take what is there and slam my <X> on top of it". Fast forward to me, there are 7 internal tables passing the data baton to each other, adding more and more on top, going through the loops, routines, re-reading the same data, you name it.

      So, the whole week and I just partially untangled the mess: eliminated unnecessary tables, renamed everything, replaced global stuff, added meaningful comments. Had no time for a complete overhaul, sadly. Maybe next time. :)

      • Apr 30 at 07:18 AM

        Two weeks for me, in reorganizing 2 BAdI's methods.

        I can relate pretty well...

      • May 05 at 06:38 PM

        The biggest benefit of OOP in this case would be that Eclipse then helps with modularization. The OOP itself doesn't make a difference except for the fact that things like the ability to extract code into a method work only in the OOP world.

        I was recently in a situation where business changed their mind 3 times and the code was similar to what you said - not great code first of all which was extended 5 times in two separate programs. One spits out a report and the other a label with almost the same information. I finally converted all the "FORMS" to "METHODS" to start and I had made all the complete change over in a couple of days with significantly easier to maintain code.

        Rob Dielemans I hope your blog covers converting traditional programs to OOP. I will be looking out for anything you write!

  • Jun 13 at 10:57 AM
                 iv_class_num         = lv_class_num
                 iv_class_type        = lv_class_type
                 iv_object            = lv_object
                 iv_object_table      = lv_obj_table
                 iv_model_name        = <fs_model_search>-name
                 iv_manufacturer_name = <fs_model_search>-manufacturer
                 et_return            = lt_return ).
          READ TABLE lt_return INTO ls_return WITH KEY type = if_ain_declarations=>sc_ain_msg_type_e    "'E'
                                                         id = if_ain_declarations=>sc_ain_id_cl         "'CL'
                                                     number = if_ain_declarations=>sc_ain_num_525."'525'.
          IF sy-subrc <> 0.

    "So I want to be symbolic and not use stupid non-semantic numbers and character strings in my code. What about just creating some monsters of constant declarations containing exactly those stupid numbers? So I can also use the whole width of my brand-new 40'' wide screen for my coding!"

  • Jun 14 at 07:34 AM

    I have been looking at this THING I have come across and crying. A class with no methods and only one attribute.

    Worse the standard SAP data element BOOLEAN is not even very Boolean as it has three values. Worse is that FALSE is denoted by a a minus sign as opposed to a space, so it is inconsistent with, say ABAP_BOOL.

    boo-hoo-lean.png (17.9 kB)
    • Jun 17 at 07:37 AM

      To be honest, I thought the same about the 3 values issue but i found out it's correct for SQL

      In SQL, which uses a three-valued logic for explicit comparisons because of its special treatment of Nulls, the Boolean data type (introduced in SQL:1999) is also defined to include more than two truth values, so that SQL Booleans can store all logical values resulting from the evaluation of predicates in SQL. A column of Boolean type can also be restricted to just TRUE and FALSE though.

      from Wikipedia.

      Defining a class to use a standard domain / data element, instead, it's crazy

      • Jun 17 at 08:26 AM

        As you point out, three-state booleans are perfectly valid. The travesty with this specimen is not the tri-state, but that SPACE has meant FALSE in ABAP's quasi-booleans for over 40 years and does so in >99.9% of code.

        So yes, the class itself is bad enough, but if you need tri-state then use another symbol. A quick check shows me over 20 boolean domains where "-" means unknown. The most obvious choice for me is BOOLEAN :)

        Edit: I just read again, that BOOLEAN is actually the SAP-supplied abomination that decides "-" means false. So I had a peek into DD07T, domain '*BOOL*', language EN, DOMVALUE_L = "-"

        In 9 cases "-" means false, 12 mean undefined.

        I need to go and sit in a dark room for a little while...

        • Jun 17 at 08:36 AM

          I think the issue has its radix in the fact that the tri-state boolean has been officialized way later than ABAP was born (ABAP end of 70s, SQL with 3 state boolean 1999) and from here the misunderstanding.

      • Jun 17 at 04:19 PM

        I always use 'X' = true, anything else is not true. Never cared if it's "false" or "undefined".

        People who define 'Y' as true deserve their own circle in hell though.

        • Jun 17 at 06:58 PM

          Particularly when SAP has used "J" for Ja on some of their screen button function modules.

          I have been using the constants "ABAP_TRUE" and "ABAP_FALSE" to set boolean variables and to interrogate their status.

          got_errors = ABAP_TRUE.
          if got_errors = ABAP_TRUE.
            (do stuff)
            (don't do stuff)
        • Jun 18 at 08:07 AM

          I would just like to mention at this point that one of our consultants back in 1999 used X for FALSE and SPACE for TRUE. I spent a day getting more and more puzzled debugging such a program before I realised what was going on.

          And as you say some people use Y/N and some people use J/N because of the German language.

          If you want to lose the will to live, look at standard SAP function module COMPARE_TABLES and see what that uses for TRUE.

        • Jun 18 at 08:34 AM

          SAP Standard FM TEXT_FOR_OPERATION:

          You have the choice of Yes and Jawohl ... everything totally mixed up.

          And don't ask me why it's defined as DATA and not as CONSTANT.

          jawohl.jpg (31.8 kB)
        • Jun 18 at 09:16 AM

          Well, i got asked by someone, "Why did you define your constant as ABAP_TRUE / ABAP_FALSE? Could you not use a more meaningful name?"

          "your constant", seriously? Deep breaths, enjoy the spring...

        • Jun 19 at 10:42 AM

          In REUSE_ALV_POPUP_TO_SELECT "Y" has a special meaning!

          If for SPOPLI-SELFLAG "Y" is set instead of "X" then the entry is checked but display-only! ;)

    • Jun 18 at 07:54 AM

      For me boolean is the very essence of thinking binary. The bits in a register can only be '0' or '1'. If you say: 'what about unpowered?'. Well in the first circuits any voltage near 5 Volts meant '1' and anything below something 2-3 Volts meant '0'. So unpowered (0 Volts) meant also a logical '0'. So there is no third state.

      So if you define some three-state data type please don't call it 'boolean'! This sounds like heresy. 'boolean?' from C# doesn't make it better.

      Mr. Bool (1815–1864) would rotate in his grave learning his name is misused that way.

      • Jun 18 at 11:25 AM

        > if you define some three-state data type please don't call it 'boolean'!

        So how do you call a Yes/No type with a third allowed answer state "I don't know"? IMHO, this third state is certainly often "difficult" from a programmer's point of view (aka easy to mess up) but nevertheless often a part of reality...

        • Jun 18 at 11:55 AM

          Easy: If you have more than 2 states you need more than 1 flag.

          • Jun 18 at 01:07 PM

            > So how do you call a Yes/No type with a third allowed answer

            Well, I was particularly interested in the name of such data type, not in its implementation:)

            • Jun 19 at 06:09 AM

              Sorry, I didn't think of a name for such a thing('cause it's an abomination in my eyes :-) ). Perhaps KNOB(KNOB is NOt Boolean)? Had in 20 something years of programming never the issue for a three state data type.

              Just wanted to defend late Mr. Bool. He built is algebra in the 19th century. His axioms are about 2-states, strictly. You see in the rest of this threat what confusions stems from this (unholy) tampering with the data type boolean. Still the majority of programmers expects from a boolean it's behavior as a (2 state)flag(hopefully). You can't mutate an apple to a pear and still call it apple. Ok, this comparison is too weak. How about this one: extend a door knocker to a wrecking ball and still call it door knocker.

              My children shall in 20 years still be able to use 'IF <booleanTypeFlag> THEN <statement> (ELSE <statement>)' without running risk of a preposterous null pointer exception, because some freelancer artisans perverted boolean to a nullable data type! *WAHOO WAHOO WAHOO* :-)

            • Jun 19 at 05:30 PM

              I propose to call it Schroedinger's variable. It's either dead or alive or who knows. :)

              Boolean is like an on/off switch. It's either on or off. The rest is heresy.

        • Jun 18 at 10:53 PM

          At university, we learned about "ternary logic" but a quick google shows there are other names used for three state logic too:

          • Jun 18 at 11:09 PM

            And if you really want to blow your mind, take a look at probabilistic logic. :-)

            • Jun 24 at 08:30 AM

              Be honest: Do you really use boolean when dealing with probabilities? Probabilities are any number between '0' and '1', per definition. With exact '0' or '1' being most unlikely. Sounds like the complete opposite of the boolean domain. Of course you need to derive decisions from this probabilities. For that you define thresholds up front(and still no guarantee). Here we have TRY - CATCH for all the unforeseen hazards unknown at design time.

              So there is still a killer argument missing why we need a three-state-boolean. Does anyone have one?

      • Jun 18 at 02:24 PM

        My thoughts exactly. Someone should send a memo to SAP.

    • Jun 19 at 06:12 AM

      just another set of boolean constants...

      boolean.png (166.2 kB)
    • Jun 20 at 11:12 AM

      ...aaaand right on cue I bump into this usage of a semi-boolean (XFELD to be precise) in MB_CREATE_GOODS_MOVEMENT. I translated the German comments into English:

          "Control if delivery should be created
          IF imseg-xdeliv = x.               "Create delivery
            xdeliv = x.                                       
          ELSEIF imseg-xdeliv = 1.           "Don't create delivery
            no_deliv = x.                                         
          ELSEIF imseg-xdeliv IS INITIAL.    "System decides (T001L)
            no_choice = x.

      Although I do like the way they defined X as a constant.

  • Jun 18 at 11:48 AM

    It just gets better and better....

    back-slash.png (3.7 kB)
  • Jun 18 at 12:25 PM

    Oh dear. Oh Dear. Oh Dear.

    • Jun 18 at 01:08 PM

      Let me guess the next entries...:)

      (Nice image title, anyway, The Police will take control:)

      • Jun 18 at 01:13 PM

        It is 100 times worse than you think. The above is followed by all sorts of constants, some sensible, most nonsense, and then right in the middle of nowhere pops up GC_MSGNO_025 with the value '025'

        • Jun 18 at 01:52 PM

          > The above is followed by all sorts of constants, some sensible, most nonsense, and then right in the middle of nowhere pops up GC_MSGNO_025 with the value '025'

          Yes, that's what I had guessed:)

    • Jun 18 at 01:17 PM

      We feel you, Paul!
      Your pain is our pain!

    • Jun 18 at 02:22 PM

      Almost threw up. Geez...

  • Jun 18 at 02:29 PM

    While we are on the subject of variables, how about the fact that for some reason WERKS is a structure (and totally not a table as description claims) and WERKS_D is actual data type for Plant (WERKS field)?

    I mean... VKORG field has VKORG data type, MATNR is MATNR but WERKS - nooo.

    men-at-werk.jpg (62.6 kB)
  • Jun 18 at 09:17 PM

    At first I thought I'd just flip the code so that the IF condition is positive but then I thought "hm, someone doesn't seem to understand how select options work..." :)

    scn.jpg (36.7 kB)
  • Jun 25 at 03:41 PM

    There's over 1000 lines of this kind of indenting insanity in IDOC_INPUT_ARTMAS.

    indent.png (14.5 kB)
    • Jun 25 at 06:33 PM

      Just need to take the keyboard away from some of them...........

    • Jun 27 at 09:38 AM

      Maybe it was generated (via transaction BDBG or BDFG).

      • Jun 27 at 10:05 AM

        I think you may be right, I had no idea such a thing existed! The last time I had to delve deep into this ALE/IDOC stuff was before BAPIs :-)

        Ist still doesn't excuse the mess though, BRFplus generates tons of code and it's reasonably well formatted.

  • Jun 26 at 04:43 PM

    This one made my brain hurt today, and not just because it_bsak was a table of company codes and document types from table REGUP.

    gore1.png (14.5 kB)
    • Jun 27 at 06:20 PM

      Adding lfs_ prefix to the field symbol is of utter importance. Because otherwise how would anyone even know it's a field symbol? I mean you can barely see those <> thingies, right?

      And g_docflag is so helpful. I can understand right away what it is for. "X marks the spot." :)

  • Jun 27 at 06:22 PM

    Another entry for the Department of Mildly Infuriating. Was searching for a domain for a 16-character field with lower case. Found this:

    scn.jpg (77.7 kB)
  • Jul 15 at 02:09 PM

    This fine day I found a good one. The program had just done a BDC to create a sales order. That does not bother me all that much, as even 20 years after the introduction of the sales order BAPI it cannot do everything VA01 does.

    Then we have a FORM routine called DISPLAY_MESSTAB which is a loop over the MESSTAB returned from the BDC CALL TRANSACTION, trying to display the messages.

    So far so good. There is a bucket load of conditional logic based on the values in each message but I can live with that as well.

    Then however the programmer decides that half way through displaying the BDC messages this is just the obvious place to do a credit check on the sales order.

    Of course it is! Where else would you do such a thing?

    • Aug 14 at 08:30 AM

      That's an Houdini. Distracting the Audience with BDC messages while doing something critical off sight :-). That's artisans doing tech. Nothing a techie has to understand...

  • Jul 31 at 01:09 PM

    If you want to have a good old cry then I would suggest looking at standard SAP program SD70AV2A.

    This program totally ignores the selection criteria the user enters on the selection screen until after it has retrieved a bucket load of data from the database.

    Only then does it start deleting the records it does not want.

  • Aug 14 at 07:33 AM

    Just seen a program where are the variables (global) have an L prefix. Furthermore, the object instance variable begins lcl_ (which in most sane programs refers to local classes).

    • Aug 14 at 11:53 AM


      Matthew, all those standards manuals are prove the existence of the "Deep IT Department", dedicated to ensuring innovative programmers are mired in useless rules and documentation and to prevent them from freeing programs from years of endless productivity.


    • Aug 14 at 02:31 PM

      I have to admit that for years in the past I just mindlessly used lv_ prefix for variables without giving any thought to whether variables were actually global or local. No one ever pointed this out to me as an issue and from simply not knowing it turned into a habit. That went on until I read some SCN blogs and started paying more attention.

    • Aug 15 at 01:59 PM

      I came across a custom program in our code base that had several MODULE/ENDMODULE with every variable inside declared with the L prefix...

    • Aug 15 at 07:30 PM

      I've also noticed that all the code is after then INITIALIZATION event. Then the selection screen is displayed...

      Developed recently, not yet in production... but give it time.

  • Aug 16 at 07:50 AM

    Perfect use of constants:

    scn.jpg (7.5 kB)
    • Aug 18 at 08:42 PM

      ...and THE_PARTRIDGE_IN_A_PEAR_TREE ! :)

    • Aug 28 at 12:16 PM

      To be fair, the extended program check will complain about the use of the literal "75" and demand you replace it with a constant of some sort.

      • Aug 28 at 12:21 PM

        True and totally okay. But the constant should be max_extension_days or so.

    • Sep 02 at 06:47 PM

      Its also a nice example of superfluous comments repeating what it says in the code and why that's a bad thing: If someone changes the constant to 90 days, the comments will be badly misleading.

  • Aug 19 at 03:41 PM

    Sadly it took about 30 seconds to find this one

    interesting.jpg (43.1 kB)
    • Aug 19 at 07:48 PM

      Haha, nice! :) I found a similar code before and had to call the team mates for counsel to make sure I'm not halucinating.

  • Aug 29 at 11:14 AM


    a strange comment

  • Add comment
    10|10000 characters needed characters exceeded