TABLES
This statement is not allowed in an ABAP Objects context. See TABLES statement not allowed and the note below.
Basic form
TABLES dbtab.
Effect
Creates an structure - the table work area - in a program, for the database
table
,
view , or structure dbtab
with the same name. The structure of the table work area corresponds exactly to the line
structure of the database table
dbtab. dbtab
must be declared in the ABAP Dictionary. ABAP Dictionary.
The fields
of the table work area are filled with the initial value appropriate for their ABAP data type. (See DATA).
Example
Display all flight connections:
TABLES spfli
SELECT * FROM spfli
WRITE: / spfli-carrid, spfli-connid
ENDSELECT.
Notes
-
You can display the structure of the table work area by double-clicking the table name in the ABAP Editor.
-
Table work areas are always globally visible, even if the TABLES
statement occurs in a
FORM or FUNCTION.
If you change a work area within a subroutine or function module, however, they remain local. You should
therefore always make your TABLES statements global. If you want to make changes locally in a subroutine, use LOCAL.
-
Please consult Data Area and Modularization Unit Organization documentation as well.
-
You can use a namespace prefix with table names.
You should only use the TABLES statement in an ABAP program
where it is absolutely necessary, namely to transport fields with an ABAP Dictionary reference between
screens and an ABAP program, or to transport data between a logical database and an executable program.
You can also use the NODES
statement with logical databases. The TABLES statement is no longer necessary for:
-
Creating a work area with the structure of a database table dbtab.
Instead, you can now use the TYPE addition in the DATA statement to refer to the ABAP Dictionary.
-
Declaring a database table dbtab in an ABAP program for Open SQL statements.
-
Implicit forms of the Open SQL statements. Instead, you should always use explicit work areas.
-
The EXPORT and IMPORT
statements for storing data clusters in cluster databases and the cross-transaction buffer. You can use a different work area for storing user data fields in data clusters.
-
Passing data to subroutines. Instead of using a shared data area, you should use explicit interface parameters for procedures.
Related
DATA, TYPES
Additional help
Interface Work Areas