Skip to Content

Unless I’m mistaken a move of non-numeric char data to an numc field will result in ABAP filling the numc field with zeroes, rather than an exception.

Although most language connoisseurs would look down on this as a “let the buyer beware” approach unworthy of SAP, I like it because it reminds me of the days when language designers could design intelligent languages because they knew that in general, intelligent programmers would be using them.

I also like it because it also provides a way to code a very convenient non-numeric test for legacy data of the sort that has all kinds of crap in it because someone didnt’ convert EBCDIC correctly … as I said, lemonade from lemons.  (Of course, if all zeroes is a valid value, then you’ve gotta be careful.)

Can anyone think of any other uses for this “successful” but incorrect conversion?

To report this post you need to login first.

4 Comments

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

    1. David Halitsky
      Hi SO – yes.  In my case, zeroes are not a valid value so the “cheat” works nicely.  But if zeroes are valid, it won’t.  (That’s why I put the note in about being careful avout all zeroes input …)
      (0) 
  1. waldemar roberti
    Hi,

    I tottaly agree with you… as more I learn Abap more and more things like this one appears… a cast that change the value to not raise the exception is really a mess in your program.

    (0) 
    1. David Halitsky
      Hi WR – Thanks for taking the time to reply.  But I am not as puristic as you, for the following reason.

      One of the pioneer 4GL’s was the User Language for the Model 204 Database – this actually served as the model for the more well-known Natural language associated with SoftwareAG’s ADABAS (which SAP bought a couple of years back.)

      M204 UL did the same thing – if you tried to move garbage to any of its binary number fields, it would just put binary zeroes in for you. 

      The attitude of the designers was: “if the programmer is stupid enough to move garbage to a binary number field, then he or she shouldn’t be using our language in the first place.”

      And to tell you the truth, I kind of like that attitude.

      Just like I like the old saying: “Real programmers don’t document – if it was hard to write, it should be hard to understand!”.

      (0) 

Leave a Reply