[英]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.所以我的公司想让我学习 SAP 的 ABAP,我已经开始学习这个。 My background is mainly VB.net and sqlserver with T-SQL but also have experience in c#.
我的背景主要是 VB.net 和 sqlserver with T-SQL 但也有 c# 的经验。
With ABAP though I am needing some clarification or confirmation on the understanding of Data Types and Domain.使用 ABAP,虽然我需要对数据类型和域的理解进行一些澄清或确认。 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)
.示例:我们有一个表 Customer,我可以有一个数据类型为
char(10)
的customerNumber
字段。 To me this mean in the table customer we have a field called CustomerNumber
that will have 10 characters.对我来说,这意味着在表 customer 中我们有一个名为
CustomerNumber
的字段,它将有 10 个字符。
However with ABAP we have Domains, Data elements then the field, does this mean we have a field named whatever we want.但是,对于 ABAP,我们有域、数据元素和字段,这是否意味着我们有一个可以随意命名的字段。 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
指定为域,这将是我认为的数据类型,例如 Char 20、Char 100 或整数字段等。
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.
谁能给我一个明确的指示,说明域> 数据元素与我所知道的 sqlserver 中的数据类型之间的区别。
Thanks谢谢
I don't know if it's 100% correct, but that's is the way I use, like you say.我不知道它是否 100% 正确,但这就是我使用的方式,就像你说的。
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.您可以重用域,如果您不打算重用,则可以直接使用数据元素并将其引用到内置类型。
EG例如
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).并非每个表字段都有数据元素(它们可以拥有内置类型),但每个字段都有类型(原始或包装在数据元素中)。
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.如果您想在屏幕 (Dynpros)、ALV 网格或其他报告中使用您的字段,那么创建将承载您的字段的业务意义的数据元素。
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!
祝你好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.