SAP TABLE WORK AREA - Guide

Get Example source ABAP code based on a different SAP table
  


GUIDELINE 6.7

Table Work Areas

ABAP_BACKGROUND
Table work areas are structured data objects of a flat structure type, a database table type, or a view type of ABAP Dictionary declared using the statements TABLES or NODES. If declared using NODES, then other ABAP Dictionary types are also possible.
From the perspective of the data type, the statements TABLES table_wa. NODES table_wa.
are the same as DATA table_wa TYPE table_wa.
This means that data objects with the same name and type as the corresponding data types from the ABAP Dictionary are declared. This is supplemented by further meanings of TABLES and NODES. For the full range of meanings, refer to the ABAP Keyword Documentation. The essential properties are as follows:
TABLES and NODES declare interface work areas, which are shared by multiple programs of a program group.
TABLES declares interfaces to classical dynpros and selection screens.
NODES declares an interface to logical databases.
In addition, you can also use table work areas that have been declared with TABLES as implicit work areas in obsolete abbreviated forms of Open SQL, or even older statements for database accesses.

ABAP_RULE
No table work areas except for classical dynpros
Only use the TABLES statement in the global declaration part of function groups to communicate with classical dynpros. Apart from in wrappers of logical databases, the statement NODES is no longer required.

ABAP_DETAILS
The statement TABLES is not allowed within classes anyway and the statement NODES can only be created syntactically in the global declaration part of an executable program associated with a logical database. The latter option is no longer allowed.
As obsolete database accesses requiring the TABLES statement and shared data areas between programs are not allowed, there is no need to use the TABLES statement, except for declaring interfaces to classical dynpros (see the following exception).

Exception
If dynpro fields in classical dynpros are defined with reference to flat structures in the ABAP Dictionary, the homonymous global data objects of the ABAP program must be declared with the statement TABLES. Otherwise, the data objects of the ABAP program are not linked to the dynpro fields, and their content cannot be accessed. In addition, TABLES is also required for declaring specific work areas when handling function codes of selection screens.

Note
The restriction on the TABLES statement to this last remaining technical requirement, that is, the communication with classical dynpros and selection screens, can also be derived from other rules of these guidelines. However, as the use of the TABLES statement instead of the DATA statement still enjoys great popularity among experienced ABAP developers, the above-mentioned rule explicitly stresses its prohibition.