ABAP Obsolete Statement: TABLES

 As part of the Obsolete statement series, today's post is about TABLES statement. 

Syntax: TABLES wa_table.

Example:

It declares a data object wa_table as a table work area whose data type is taken from the identically named table wa_table in the ABAP dictionary. DB tables and views can be used to declare their work areas using TABLES statement.

Table work areas declared using TABLES are interface work areas( a special data object that can act as a cross-program interface between program and screens or logical databases.

The statement TABLES is not allowed within classes anyway. Since obsolete database accesses requiring the statement TABLES and shared data areas between programs are not allowed, there is no need to use the statement TABLES.

In other words

The main purpose of the TABLES statement is to act as an interface work area to share data across programs and screens, since the shared data areas between programs are not allowed, the tables statement becomes obsolete except for classic dynpros.

If dynpro fields in classic dynpros are defined with reference to flat structures in ABAP Dictionary, the identically named 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.

In conclusion,

Even though TABLES statement is obsolete, it is still needed to transfer data from dynpros whose fields are declared referencing flat structures from ABAP data dictionary or dealing with selection screen fields.
An Example of where TABLES statement is still relevant.
Thanks for reading and as always I hope this post helps you in your day to day development.

Popular posts from this blog

ABAP convert internal table to excel (.xlsx) format and Send email or download

ABAP read excel(.XLSX) file to internal table in ABAP using CL_FDT_XL_SPREADSHEET

Application Logging in ABAP