SAP TABLES ABAP Statements



Get Example source ABAP code based on a different SAP table
  


ID TABLES
• TABLES ABAP Statement

TABLES
Short Reference

ABAP_SYNTAX
TABLES table_wa.

What does it do?
This statement is not allowed in classes and declares a data object table_wa as a table work area whose data type is taken 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. Either DDIC database tables or DDIC views with flat components can be specified for table_wa.
Table work areas declared using TABLES are interface work areas and should only be declared in the global declaration part of a program for the following purpose:
The statement TABLES is required for exchanging data between dynpro fields and the ABAP program, if the fields were defined in a dynpro of the program by being taken from the ABAP Dictionary. In the dynpro event PBO , the content of the table work area is passed to identically named dynpro fields. In PAI, the system takes the data from identically named dynpro fields.
In executable programs, flat table work areas can be used to copy the data that is provided for the event GET table_wa by a linked logical database. TABLES is synonymous with the statement NODES for this purpose.

ABAP_PGL
No table work areas except for classic dynpros
ABAP_PGL_END



Latest notes:

Table work areas declared using TABLES behave like shared data declared using the addition COMMON PART. They are shared by the programs of a program group. This feature should not be exploited for reasons outlined in Program Groups in External Procedure Calls.
Table work areas declared using 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 compilation unit. It is visible in the compilation unit as soon as it is declared and lives for as long as the compilation unit. In contrast to regular program-global data, the content of the table work areas declared in subroutines and function modules is stored temporarily when these are called. Assignments that are made during the runtime of the procedure are preserved only until the procedure is completed. When the procedure is exited, the table work areas are filled with the content that they contained when the procedure was called. Table work areas declared in procedures behave like global data to which the statement LOCAL is applied in the procedure.
It is recommended that NODES and not TABLES is always used for interface work areas for logical databases. This makes it clear that they are nodes of logical databases.
A CDS entity cannot be specified after TABLES. A CDS-managed DDIC view should not be specified, since the usage of CDS-managed DDIC views is obsolete.
The variant TABLES * is completely obsolete.
ABAP_HINT_END



Example ABAP Coding

Declaration of a table work area demo_conn with reference to the identically named dictionary structure DEMO_CONN in a module pool. PROGRAM demo_dynpro_module.

TABLES demo_conn.

...
ABAP_EXAMPLE_END

Return to menu