Kevin Holtkamp
Kevin Holtkamp

Reputation: 468

What is the best-practice to replace that TABLES statement in OOABAP?

In the following code:

TABLES: lqua.
CLASS TEST DEFINITION.
PRIVATE SECTION.
  TYPES: BEGIN OF tt_data,
          lgpla TYPE lqua-lgpla,
          matnr TYPE lqua-matnr,
         END OF tt_data.
ENDCLASS.

How could I get rid of the TABLES statement? As far as I understand, it is best-practice to avoid the TABLES statement, and it is forbidden in classes. When I omit it, the definition of tt_data throws a syntax error because lqua-lgpla is unknown.

Upvotes: 2

Views: 1231

Answers (1)

Jagger
Jagger

Reputation: 10524

This does compile without any error.

REPORT zzpj_so.

CLASS test DEFINITION.
  PRIVATE SECTION.
    TYPES: BEGIN OF tt_data,
             lgpla TYPE lqua-lgpla,
             matnr TYPE lqua-matnr,
           END OF tt_data.
ENDCLASS.

What does not is for example this piece of code.

REPORT zzpj_so.

CLASS test DEFINITION.
  PRIVATE SECTION.
    TYPES: BEGIN OF tt_data,
             lgpla LIKE lqua-lgpla,
             matnr LIKE lqua-matnr,
           END OF tt_data.
ENDCLASS.

Upvotes: 2

Related Questions