Skip to Content
author's profile photo Jelena Perfiljeva

Share your "ABAP gore" (CLOSED, see Part 2)

NOTE: Due to volume, second part of this discussion was created. Please post any new items there. Thanks!

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 16, 2018 at 12:05 PM

      Pretty Printer... such mistery tool.

      • May 16, 2018 at 12:12 PM

        And so new...

      • May 25, 2018 at 11:51 AM

        I instructed a developer who changed a small part of something I'd written that since I'd made the program nicely formatted, it was matter of courtesy that he should do the same.

        The car park is awfully dark....

  • 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, 2019 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, 2019 at 06:08 AM

    I checked the old programs and found this :)

    abapgore.jpg (8.1 kB)
  • Jan 14, 2019 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, 2019 at 07:47 AM

    7.50 program developed in the last 3 months.

      PERFORM checks.
    FORM checks.
    ...more then 4000 lines later.
    • Jan 18, 2019 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, 2019 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, 2019 at 01:27 PM

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

  • Feb 08, 2019 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, 2019 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, 2019 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, 2019 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, 2019 at 01:46 PM

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

    selection.jpg (123.6 kB)
    • Feb 25, 2019 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, 2019 at 05:46 PM

      Some major checkbox addiction there. :)

      • Mar 22, 2019 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, 2019 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, 2019 at 01:00 PM

    Here is my one for today.

    • Mar 04, 2019 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, 2019 at 07:01 AM

        Funny you should say that....

        • Mar 05, 2019 at 08:50 AM

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

          • Mar 05, 2019 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, 2019 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!

      • Oct 15, 2019 at 11:33 PM

        have a look at this wonderful SAP Standard error message definition

  • Mar 22, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 at 07:18 AM

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

        I can relate pretty well...

      • May 05, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 at 11:55 AM

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

          • Jun 18, 2019 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, 2019 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, 2019 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, 2019 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, 2019 at 11:09 PM

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

            • Jun 24, 2019 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, 2019 at 02:24 PM

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

        • Jun 19, 2019 at 07:40 AM

          Thanks, for assist.

          Seems like the boolean question branched into it's own topic.

    • Jun 19, 2019 at 06:12 AM

      just another set of boolean constants...

      boolean.png (166.2 kB)
    • Jun 20, 2019 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.

    • Sep 27, 2019 at 02:43 PM

      Yesterday I was in a hands on workshop at Teched about the RESTFul ABAP Programming Model.

      I notice at some points, when you are updating an “entity” you give a list of what fields you are changing, just like the BAPE_VBAPX where you pass TRUE to each field you actually want to update.

      It is the same here, you have a control structure with all the fields and you pass a constant to each field you want to change. I did an F3 on the constant to see the value (this is Eclipse so a double click does not work). I was expecting an X for TRUE, but no, it is 01 for True and 00 for FALSE.

      • Sep 30, 2019 at 02:25 PM

        Fabulous (not).

      • Oct 14, 2019 at 12:22 AM

        Today's "Boolean" values I have come across are stored in an enumeration.

        The possible values are:-




        Having YES and NO would be too obvious. The calling code is asking a question along the lines of "Is there an entry XYZ in this table?" and the system knows if there is or not. The only possible reason for responding with MAYBE is to annoy the caller. It is rather like the standard SAP error message "there is either no entry in the table OR you are not authorized to see it" which has the hidden long text "I know which one it is, but I am not telling you! Na na na na na!"

        • Oct 14, 2019 at 09:08 AM

          A real Schroedingers Boolean should be Yes, No, Both.

        • Oct 14, 2019 at 11:32 AM

          So computers are told to act like modern humans? Give no straight answer and don't take any responsibility for whatsoever? Why not Boolean 'no answer without my attorney'?

  • Jun 18, 2019 at 11:48 AM

    It just gets better and better....

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

    Oh dear. Oh Dear. Oh Dear.

    • Jun 18, 2019 at 01:08 PM

      Let me guess the next entries...:)

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

      • Jun 18, 2019 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, 2019 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, 2019 at 01:17 PM

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

    • Jun 18, 2019 at 02:22 PM

      Almost threw up. Geez...

  • Jun 18, 2019 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, 2019 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, 2019 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, 2019 at 06:33 PM

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

    • Jun 27, 2019 at 09:38 AM

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

      • Jun 27, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 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, 2019 at 07:50 AM

    Perfect use of constants:

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

      ...and THE_PARTRIDGE_IN_A_PEAR_TREE ! :)

    • Aug 28, 2019 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, 2019 at 12:21 PM

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

    • Sep 02, 2019 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, 2019 at 03:41 PM

    Sadly it took about 30 seconds to find this one

    interesting.jpg (43.1 kB)
    • Aug 19, 2019 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.

    • Nov 01, 2019 at 12:54 PM

      At least they fixed the bug reported in ticket 825!

  • Aug 29, 2019 at 11:14 AM


    a strange comment

  • Oct 29, 2019 at 06:26 PM

    Stuff like this just makes me lose the will to live on some days, sigh...

    Let me set the scene for you. Here we have a global internal table:

    DATA: BEGIN OF tlips OCCURS 0.
    DATA: mes(1) TYPE c.
    DATA: END OF tlips.

    Then we have a LOOP and a subroutine call. It's kind of a moot point using global variables as parameters but the at least the second parameter should've been CHANGING. But wait, there is more to it.

    LOOP AT tlips.
    PERFORM get_item_config USING tlips-cuobj tlips.
    IF NOT tlips-mes IS INITIAL.

    For the grand finale - using, shmoosing, who cares, "imma update global variable and head out":

    FORM get_item_config USING l_cuobj
    l_lips STRUCTURE tlips.

    IF <something>.
    tlips-mes = 'Y'.

    Fade to black.

  • Oct 30, 2019 at 07:17 AM

    I have funny one (it is a free adaptation, I cannot do a copy/past)

    returns = lt_return.    "<-- I keep the LT_ for Matthew
    IF lt_return[] is initial.
      READ TABLE lt_return with key MSGTY = 'E'.
      IF sy-subrc EQ space.
        " Error
        " No error

    I am still thinking about this, what ... why ... ?

    • Oct 30, 2019 at 01:46 PM

      sy-subrc EQ space?


      • Oct 30, 2019 at 01:54 PM

        it's an old abap statement ;)

        (the code is little bit old)

        • Oct 30, 2019 at 07:55 PM

          But sy-subrc is INT4 type, space has never been a valid value for it. Funny enough, that part actually escaped my attention altogether since I didn't looked past IF sy-subrc... :)

          The whole thing is just bizarre though. So, if there is "no error" then we don't commit?

          • Oct 31, 2019 at 06:26 AM

            Exactly, if there is information message, the program didn't commit, and worste wrote a message explaining it was not saved, but in reality, the data are commited

  • Nov 04, 2019 at 05:56 AM

    Today I to change a program supplied to us by our auditors. You can tell my changes because they are inside FORM routines. There were none before - it was hundreds of lines of code following START-OF-SELECTION.

    Naturally all the variables are global.Half have no prefixes, half are prefixed with L_

    I considered adding a local class but was worried it might die of shock in such an alien environment.

    • Nov 04, 2019 at 07:19 AM

      Didn't you create global class & call directly this global class in the old program ? This kind of old programs have a lot of time so much lines ...

      • Nov 04, 2019 at 07:33 AM

        You are presuming it is an old program. Sadly it was written recently.

        I was told not to put too much effort into this as we pay our auditors a vast amount of money as it is, and me improving their programs for them on top of that, so they can charge us more next year because their programs are so much better, is adding insult to injury. So I just got it working.

        I am deliberately not saying which one of the big four audit companies this is, but I will give you a clue. Their name is not "Tuesday".

  • Nov 06, 2019 at 07:28 PM

    Well, we know it's initial buuuuuuuut just to be on the safe side...

    scn.jpg (11.8 kB)
    • Nov 07, 2019 at 06:49 AM

      I see something like that longtime ago, looks like

      SELECT maktx INTO lv_material_description FROM makt WHERE spras EQ ... 
        IF sy-subrc EQ space.
  • Nov 07, 2019 at 12:57 PM

    SAP wants to confuse me: IF / ELSE / ELSE / ENDIF ???

    gore.jpg (16.5 kB)
  • Nov 13, 2019 at 09:28 AM

    The developer has forgotten the Clean Code /Clean ABAP Rule: Try to make conditions positive!

    code.png (2.8 kB)
    • Nov 13, 2019 at 12:23 PM

      Did a double check before looking dumb.

      Does IF in ABAP work different from other languages(C-based)?

      If not, that IF clause doesn't make any sense. The first condition is true if lv_day is not equal 6, which is also true for 7.

      The second condition is true if lv_day is not equal 7, which is also true for 6.

      Both conditions combined with OR(true if one condition is true) results in always true(Also in ABAP?).

      Please don't tell me ABAP does it different.

      • Nov 13, 2019 at 12:42 PM

        Of course, the if is always true. That was the bug which I had to fix. But the original developer did not realized that, and I also had to read this twice. I always try to make conditions positive.

        • Nov 13, 2019 at 12:59 PM

          Sorry for being Cpt. Obvious. Just wanted to make sure not to miss something.

    • Nov 21, 2019 at 03:21 AM

      I am somewhat of a lunactic so I would have a functional method called "IT_IS_THE_WEEKEND"

  • Nov 20, 2019 at 09:30 AM

    #wtf (VAT)

    vat.jpg (7.4 kB)
    • Nov 20, 2019 at 10:48 AM

      I am... astonished.
      The hope the developer shows here in governments and laws is simply perfect and warms my cold and stone heart.

    • Jun 04, 2020 at 07:13 AM

      Starting JUL 1st these lines of code are valid again in Germany (for half a year) :-)

  • Nov 21, 2019 at 03:26 AM

    When I make a change to an old program I always ask WHY/? Most times the business analyst is unable or unwilling to tell em and there is no functional specification outside of a post-it note. Obviously I have to make the change but I comment it thus:-

    • Nov 21, 2019 at 07:01 AM

      You could easily understand why you have more than 8.900 lines when you have this

      • Nov 21, 2019 at 08:10 PM

        I usually think someone must be paid by the line when I see stuff like this. :) The worst part is that (1) now you're thinking "is there some catch here?" (2) sometimes there is indeed a catch: 1 line in 20, variable has a different name by 1 character.

        Pure, grade A technical debt. Gah!

        • Nov 22, 2019 at 06:29 AM

          it is something I really appreciate with the new abap statement, there is a lot of way for reducing the number of lines. It is more easy to reach the less than 5 lines by method.

          • Nov 22, 2019 at 08:33 AM

            I'm not always so happy with line reduction to be honest.

            I can sacrifice some space to fav a better readability of the code: the new ABAP is cool, but sometimes you have to stop and think really well about what you are reading.

            Surely it's a matter of habit, but still... I'm the turtle, so slowly shift to adapt :D

            • Nov 22, 2019 at 08:58 AM

              I am agree with you, some statement like REDUCE could be sometime a nightmare to read.

  • Dec 02, 2019 at 10:29 PM

    it has been 20 years and I only noticed today that you type in a forty character description when creating a customer, and only the first 35 get stored in KNA1. The full description only goes into ADRC.

    If you are going out of your way to store the same data twice in two different places, why not capture the full value in both places? Why store data you know for a fact is 100% going to be wrong?

    It is the same with the customer purchase order number.

    Why? Why? Why? Why? Why?

  • Jan 13, 2020 at 11:07 PM

    Today's award goes to standard table TVARVC. This is designed to store parameters and selection-options. LOW, HIGH and SIGn are field names I would expect. So far so good. But then you have a field called OPTI instead of OPTION.

    Why? What did the letters O and N ever do to upset the creator of that table?

    It is just like the 54 different structures for storing error messages where the rule is never call the field that stores the message number the same name twice.

    • Jan 15, 2020 at 03:35 PM

      I guess it's SAP equivalent of "thank u". How difficult is it to type 2 more letters? And what a difference it makes. smh

    • Jan 17, 2020 at 06:40 AM

      I am always thinking, finding the good name of things is really difficult.

      Event OPTION, for me it is not really reflecting the content of this field. In the SAP Doc, they are called Relational Operators. And the word OPTION is never used in the whole page (ABAPDOCU : rel_exp - Relational Operators for Character-Like Data Types ).

      • Jan 17, 2020 at 08:11 AM

        It has been said there are only four difficult problems in computer programming:-

        • Caching
        • Naming Things
        • Off by one errors

        Naming things is what we are talking about here. Regardless of whether OPTION is a good name or not, 90% of SAP structures use the name OPTION to refer to the same concept, so I think the other 10% should as well.

  • Jan 21, 2020 at 07:03 AM

    This is not an ABAP Gore, it is a Functional request Gore:

    "Sort by ascending cumulative quantities"

    my brain make a short dump reading this

  • Jan 29, 2020 at 06:57 PM

    Would you see a routine (or even method) called cancel_shipment_update and think it cancels some update process? How wrong would you be. :) It actually executes the update process to cancel a shipment.

    • Jan 30, 2020 at 06:28 AM

      could be a not native english developer

      It does not follow the rule: Method start with a verb.

      (If I remember well my english lesson, in this case "Cancel" is a noun)

      Jelena Perfiljeva, do you think it is possible to create a release 2 of your topic ? It takes more than one minute to open it.

      • Feb 04, 2020 at 10:06 PM
        do you think it is possible to create a release 2 of your topic ?

        Frederic, this is the most terrifying request I received on SCN so far. :) One would hope we didn't need this anymore. But alas... I see what can be done, thanks for a suggestion!

      • Feb 18, 2020 at 09:25 PM

        Frederic Girod - your wish is my command. :) Part 2 opened. Thanks for the suggestion!

        P.S. I checked with the moderators and there is no option to close/lock the discussions. So I did just like SAP customers that put "DO NOT USE" in the material/customer name. :)

  • Jan 30, 2020 at 03:17 PM

    A developer who does not know that "inner join" exists:

    select * from hrp9000 into table lt_9000 where zhro_niv_unit = '2' and endda = '99991231'.
    loop at lt_9000 into lwa_9000.
      select single * from hrp1000 into lwa_1000 where objid = lwa_9000-objid and endda = '99991231'.
      move lwa_1000-short to lwa_entityset-code.
    • Feb 04, 2020 at 09:26 PM

      Or even FOR ALL ENTRIES (in case JOIN is not possible due to table type, like good old BSEG).

  • Jan 30, 2020 at 09:30 PM

    This has been my favorite for some time.

    CLEAR: w_txt1,w_txt2,w_txt3,w_txt4.
    w_txt1 = text-023.
    w_txt2 = text-024.        
    w_txt3 = space.
    w_title = text-024.
    PERFORM popup_to_inform.
    FORM popup_to_inform .
          titel = w_title
          txt1  = w_txt1
          txt2  = w_txt2
          txt3  = w_txt3
          txt4  = w_txt4.

    7 lines of code to "modularize" a... 7 line function signature. And the data is transferred using global variables.

    • Jan 31, 2020 at 06:19 AM

      I saw this so many time, and a lot of developers does not understand why it is "bad"

    • Jan 31, 2020 at 11:33 AM

      Bit like this one from a post today.

    • Feb 04, 2020 at 09:51 PM

      ...and then the routine is called just once. :) Also "pop-up to inform failure" - isn't that what MESSAGE command is for?..

  • Feb 10, 2020 at 12:07 AM

    I have two today. Both are in regard to the good old "clean code" where if you have to change someone elses code it should be obvious what it does.

    Have a look at this and tell me what you think.

    horrible-thing.jpg (305.3 kB)
    • Feb 10, 2020 at 06:17 AM

      I love this one!

      I image when the guy just finished his code, if the functional came back and said "how I forget one more field, and maybe we have to change 2 rules"

    • Feb 10, 2020 at 04:26 PM

      OK, if I had the actual award to give out, that would take it. You won, Paul! :)

    • Feb 11, 2020 at 01:30 PM

      Weeelllll, at the risk of getting beaten, and not knowing ABAP myself (so I can't tell at all how it's done usually), I guess it easily could have gone worse...

      Of course that's a big decision table but at least it seems ordered rather reasonable, i.e. the different conditions are built the way you learn it in a course on logics, right? I.e. start with varying the last basic condition, then with the second last, and so on.

      A truly chaotic person would certainly have used his own ordering and would have swapped the order of the basic conditions and the like.


      Volker Running and Ducking

      • Feb 12, 2020 at 06:31 AM

        Hi Volker Barth

        It looks organized at first reading, but add a second reading. More or less he tries to test if variables equal the possible value or space.

        He creates a big list of possibilities.

        I don't remember the exact name in Mathematic, but you have a method to stop testing everything, but testing just the case you need.

        So quickly (and without testing, because it is so big), I am pretty sure following the boolean rules, you could replace this by a negation and a OR

        not( disp_grp ne iv_disp_grp or ( plant not in ir_werks and not eq space ) ... )

        I don't know if it will be faster or slower, I know double negation is evil, but you will replace all this by a simple line.

        imagine the logic if he needs to add a new variable, the number of tests will double

  • Feb 10, 2020 at 12:10 AM

    The second one for today is the ABAP keyword EQUIV. I had never even heard of it before today until the ABAP editor proposed it.

    I used the F1 help to look it up and find out what it does. When I found out I was physically sick on the programmer sitting on the next desk.

    That is the 100% opposite of clean code.

    • Feb 10, 2020 at 11:05 AM

      I guess his code was pretty dirty by the time you'd thrown up over him.

      What were the language designers thinking of? Why not just introduce XOR, or XNOR if you have to.

    • Feb 10, 2020 at 04:26 PM

      Made me look. What the heck... 8-[ ]

      Edit: apparently, someone already noted about readability back in 2013 (no comment from SAP). And I even commented on that blog but I guess my mind deleted that memory in self-preservation. :)

  • Add a comment
    10|10000 characters needed characters exceeded