0

I'm researching the data types of the field of SAP's data table. I realized that the fields that only store numbers are sometimes varchar or char data types. e.g., KUNNR(Customer Number) and BUKRS(Company Code) are character data types.

What is the objective or benefit of defining the data type of the fields to varchar/char instead of int when determining the field's data type that only contains numbers by its name's definition?

edit: SAP has "numc" data type and for numeric text and "INT1/2/4/8" data type for interger but use char/varchar for Customer Number or Company Code instead. Please help me if you have the idea why they use char data type for the above cases. I'm now trying to create data schema by referencing SAP's data schema.


Pages that referencing details of SAP's table/fields:

http://www.saptables.net/

https://sapstack.com/

  • 1
    Please edit your question to contain all the details so that it's not required to navigate to an external Web page (which might disappear in the future) to understand the question. Moreover, the word "tend" does not reflect the exact situation; the fact is that they can be represented either through characters or numeric types, I don't think there's any tendency. – Sandra Rossi Nov 17 '21 at 06:46
  • I don't know all the reasons but one of them is that SAP ERP software can be customized so that the "object" IDs can be numeric (auto-increment) or alphanumeric (manually chosen). `MANDT` was once possible to contain characters in SAP internal systems. About all the reasons, it's hard to say: SAP ERP has always kept ascending compatibility and SAP ERP software used to exist for 40 years. – Sandra Rossi Nov 17 '21 at 06:53
  • Sap store numbers as decimal. The only type that contain numbers, but stored as string is [`numc`](https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenddic_special_character_types.htm), and `c` in its name is the reason. It is generally used for identifiers or enumerators (like line number) – astentx Nov 17 '21 at 07:15
  • Some fields use numc instead of char but some other fields use char e.g. https://sapstack.com/tables/dataelements.php?field=BUZEI – 上原英知 Nov 17 '21 at 08:09
  • >>Sandra Rossi I understand what you said. SAP might want compatibility for future development for internal and external( for the specific company). But seeing thorough hundreds of fields of the SAP's data table today, almost all fields, including the name indicating number, were varchar or char. I don't think It's surprising for us to wonder what is beneficial for them to use char instead of integer heavily. – 上原英知 Nov 17 '21 at 15:25

1 Answers1

0

Companies in global supply chain exchanges their transaction data through Electronic Data Interchange(EDI). The data is often variable-length XML or something similar. SAP mainly uses varchar to efficiently use the data for their application. The XML message data for transaction vary from business to business; sometimes number sometimes charcter but required to handle and save to it the database.