Why is there a data type NUMC?
Hi ABAP masters,
working in database support for several years I've very often seen the problems that arise from the awkward data type NUMC.
A numeric type stored as characters.
What I always wondered is: what is this data type really good for?
The leading zero output display alone is hardly a valid reason to waste storage and complicate the usage of the data of that type.
I cannot imagine any use for this data type that wouldn't be better done by using integer types.
So, if you know what the reasoning behind this data type is, please let me know.
thanks and best regards,
Marcin Pciak replied
Although it is indeed complicated in handling that data objects, there are some places where using them is better choice that using char types. I.e
- postal codes
- PO box numbers
- screen fields where only digits are allowed
Ok, you may say that above are examples of leading zeros usage but it's much easier to handle them as strings as well. When concatenating we don't have to worry about zeros we might forget in front of data objects, which of course can change value we are interested in - if not provided.
Very often happend to me that in excel when comparing some values (after importing some data file) I forgot about leading zeros (i.e for some SUBTYPE field) which turned out be a pay in the neck before I indentified the issue. That's why I really appreciate N type in ABAP
Also range should be of special importance here. Max bytes for N is 65535, while for integer is only 4 bytes, which implies what a®s said about field length.