The TABLES Statement

With the TABLES statement, you can create a data object called a table work area. A table work area is a field string which refers to ABAP Dictionary objects. The syntax is as follows:

Syntax:

TABLES <dbtab>.

<dbtab> is the name of the ABAP Dictionary object and also the name of the table work area created. The sequence and the names of the components of the table work area are the same as for the object declared in the ABAP Dictionary.

Valid ABAP Dictionary objects you can reference are

To create objects in the ABAP Dictionary, you can, for example, chooseTools ® ABAP Workbench ® Development ® ABAP Dictionary on the R/3 initial screen or double-click on the object’s name in the TABLES statement. For further information, see the online documentation for the ABAP Dictionary.

The table work area provides an interface for loading data from database tables into your program or for modifying the contents of database tables with Open SQL statements (see Reading and Processing Database Tables ).

To display a list of a table's components and their data types, you type SHOW <dbtab> in the command line of the ABAP Editor (choose Edit ® More functions ® Command input).

The data types of ABAP Dictionary objects are not the same as the data types of the ABAP type concept. Refer to the keyword documentation of the TABLES statement for a list of ABAP Dictionary data types and how they correspond to the data types in ABAP programs.

To address the components of a table work area, use the table name as prefix and append the component with a hyphen: <dbtab>-<component> (see The DATA Statement for Structures).

TABLES: SPFLI.

SELECT * FROM SPFLI.
   WRITE: SPFLI-MANDT, SPFLI-CARRID, SPFLI-CONNID,......
ENDSELECT.

In this example, the TABLES statement creates a table work area SPFLI. SPFLI has the same structure as the database table SPFLI declared in the ABAP Dictionary. In the SELECT loop, the table work area SPFLI is filled with rows from the database table SPFLI (see Reading and Processing Database Tables).