以下是来自SAP官方的解释, 就是声明一个数据对象与table一样的作为工作区。
1.Syntax
TABLES table_wa.
2.Effect
This statement is not allowed in classes and declares a data object table_wa as a table work area whose data type is adopted from the identically named structured data type table_wa from the ABAP Dictionary. table_wa must be defined as a flat structure in ABAP Dictionary. Either database tables or views can be specified for table_wa.
Table work areas declared with TABLES are interface work areas and should only be declared in the global declaration section of a program for the following purpose:
• The statement TABLES is required for exchanging data between dynpro fields defined in a program dynpro by being taken from ABAP Dictionary, and the ABAP program. For the dynpro event PBO, the content of the table work area is passed to identically named dynpro fields; for PAI, the system takes the data from identically named dynpro fields.
• In executable programs, flat table work areas can be used to copy data that is provided for the event GET table_wa from an associated logical database. TABLES is synonymous with the statement NODES for this purpose.
由于tables的用法已经很旧了,这里定义了一个全局变量。但实际可以定义了一个局部变量就可以,还是在alv展示中一个用法 。
tables的用法
TABLES ZZLD.
SELECT-OPTIONS:
S_ZPSDH FOR ZLLD-ZPSDH, " 单据号码
替代用法
DATA DUMMY_ZLLD TYPE ZLLD.
SELECT-OPTIONS:
S_ZPSDH FOR DUMMY_ZLLD-ZPSDH, " 单据号码
3. tables的用法
Tables在旧的SAP系统重还大量存在这样的用法
为什么自己建表可以当变量用
原因