ABAP Keyword Documentation → ABAP - Reference → Declarative statemnts → Data Types and Data Objects → Declaring Data Objects
TABLES
Other versions: 7.31 | 7.40 | 7.54
Syntax
TABLES table_wa.
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 the ABAP Dictionary. You can specify database tables or
views 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 screen fields that were defined in a program screen by copying them from the ABAP Dictionary, and the ABAP program. For the screen event PBO, the content of the table work area is transferred to identically named screen fields; for PAI, the system adopts the data from identically named screen fields. -
In executable programs,
flat table work areas can be used to copy data that is provided for the event
GET table_wa
from a linked logical database.TABLES
is synonymous with the statementNODES
for this purpose.
Programming Guideline
No table work areas except for classical dynpros
Notes
-
Table areas declared with
NODES
behave like common data declared with the additionCOMMON PART
. They are shared by the programs of a program group. This feature should not be exploited for the reasons outlined in Program Groups in External Procedure Calls. -
Table work areas declared with
TABLES
can be declared in subroutines and function modules. However, this is not recommended. A table work area declared in a procedure is not local but belongs to the context of a framework program. The table work area is visible as soon as the framework program is declared and exists for the duration of the framework program. In contrast to normal program-global data, the content of the table work areas declared in subroutines and function modules is stored temporarily when these subroutines and function modules are called. Value assignments that were made during runtime of the procedure are preserved until the procedure is completed. When the procedure is exited, the table work areas are filled with the contents that they contained when the procedure was called. Table work areas declared in procedures behave like global data to which the statementLOCAL
is applied in the procedure. -
Always use
NODES
and notTABLES
for interface work areas for logical databases. In this way, you make clear that they are nodes of logical databases. -
The variant
TABLES *
is completely obsolete.