ABAP Domain and Data Types Understanding

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



ABAP Domain and Data Types Understanding



so my company wants me to learn ABAP for SAP and I have started on the road to learn this. My background is mainly VB.net and sqlserver with T-SQL but also have experience in c#.



With ABAP though I am needing some clarification or confirmation on the understanding of Data Types and Domain. If anyone can help.



My understanding currently is we have a table, in the table we have fields and the fields have data types and lengths if needed. Example: We have a table Customer, I could have a customerNumber field with the data type of char(10). To me this mean in the table customer we have a field called CustomerNumber that will have 10 characters.


customerNumber


char(10)


CustomerNumber



However with ABAP we have Domains, Data elements then the field, does this mean we have a field named whatever we want. As the field could mean anything we assign a data element which has the descriptions of the sort of data stored within the field. However to store the format and data type we need to assign the Domain to the Data element.



For example I call a field ZCUSNO, currently this means nothing however if I assign the ZCTNMR (with description of customer number) Data element this tells us that the field ZCUSNO is ZCTNMR so ZCUSNO is a customer number field.


ZCUSNO


ZCTNMR


ZCUSNO


ZCTNMR


ZCUSNO



Now within the data elements we would have a domain and for our example ZCTNMR data element (the customer number) we could assign ZCTDOM as the domain which would be what I recognise as the data types so Char 20, Char 100 or integer field etc.


ZCTNMR


ZCTDOM



Is my understanding correct on this? and could someone give me a clear indication of what the difference between a Domain > Data Element is against what I would know as data types in sqlserver.



Thanks





I have 2 remarks. 1) In your example, your table has the column ZCUSNO. Its Z prefix is useless/incorrect. If it's in a custom table, the Z prefix is useless (and so not recommended). If it's appended to the columns of a standard table, then the prefix should be ZZ (or YY) according to the SAP naming recommendations. 2) Both the data element and domain are not mandatory anymore but they should be used most of the time to achieve a good modeling PS: the answer by I.B.N. is the best according to me because it answers clearly your question.
– Sandra Rossi
Aug 10 at 17:22


ZCUSNO





also answers there : answers.sap.com/questions/593605/…
– Sandra Rossi
Aug 11 at 12:21




3 Answers
3



I don't know if it's 100% correct, but that's is the way I use, like you say.



You can reuse the Domain, If you don't plan to reuse you can use direct the Data Element and refer this to a built-in-type.



E.G.



Your understanding is pretty correct and not much can be added here.



You should clearly get the main thing.



Not every table field has data element (they can possess builtin type) but every field has type (either primitive or wrapped in data element).



enter image description here



If you wanna use your field in screens (Dynpros), ALV grids or other reports, then create data elements that will bear business meaning of your field.



If you use this field just for calculations or other utility internal tasks, then don't bother yourself.



Final: Actually, the good practice, as I think to create a domain for data element, it may help you in future.



I hope that it helps you. Good luck!






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard