简体   繁体   English

abap中表和数据之间的差异

[英]difference between tables and data in abap

I have a question about ABAP: 我有一个关于ABAP的问题:

What is the difference between the two statements: 这两个陈述有什么区别:

tables mara.

and

data: test type mara.

is it now quite the same?t 它现在完全一样吗?

tables mara. 

declares an internal table with header, structure of line of the internal table is defined as transparent table mara. 声明一个带有头的内部表,内部表的行结构被定义为透明表mara。

it is proposed not to use a internal table with header, because this is confusing. 建议不要使用带有标题的内部表,因为这是令人困惑的。

data: test type mara.

declares an work area with structure defined as transparent table mara, in another words the structure has same field as the table mara. 声明一个工作区,其结构定义为透明表mara,换句话说,该结构具有与表mara相同的字段。

The tables statement declares a work area for a data dictionary table/structure and is generally used for logical databases. tables语句声明了数据字典表/结构的工作区,通常用于逻辑数据库。 The data statement is used to create a variable of any type DDIC, local or temporary. data语句用于创建任何类型DDIC的变量,本地或临时。

So the tables statement doesn't really let you define any variable you would like and generally should only be used for logical databases since like header lines on internal tables it makes your code somewhat obscure (there is a reason header lines and tables statements are no longer supported in OO Abap). 所以tables语句实际上并没有让你定义你想要的任何变量,一般只应该用于逻辑数据库,因为像内部表上的标题行一样,它使你的代码有些模糊(有一个原因是标题行和表语句都没有OO Abap支持更长时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM