Cannot Use OCCURS with Declarative Statements

In ABAP Objects, you cannot define internal tables using the OCCURS addition in the TYPES or DATA statements (or any other declarative statement).

In ABAP Objects, the following statements cause an error message:

TYPES|DATA: BEGIN OF itab OCCURS n,
  ...
  fi ...,
  ...
END OF itab.

and

TYPES|DATA itab TYPE|LIKE line_type OCCURS n.

Correct syntax:

TYPES|DATA: BEGIN OF line_type,
  ...
  fi ...,
  ...
END OF line_type.

TYPES itab TYPE|LIKE STANDARD TABLE OF line_type
                     WITH NON-UNIQUE DEFAULT KEY
                     [INITIAL SIZE n].

DATA itab TYPE|LIKE [STANDARD] TABLE OF line_type
                    [INITIAL SIZE n].

Cause:

TYPE|LIKE TABLE OF, the new additions of the DATA and TYPES statements, make the OCCURS addition superfluous in table declarations. If necessary, you can define the initial main memory requirement using the INITIAL SIZE addition.

Note:

The system automatically updates the short form

DATA itab TYPE|LIKE TABLE of line_type.

to

DATA itab TYPE|LIKE STANDARD TABLE OF line_type
                    WITH NON-UNIQUE DEFAULT KEY
                    INITIAL SIZE 0.

so that you can use the former.

The system automatically updates the short form

TYPES itab TYPE|LIKE STANDARD TABLE of line_type.

to

TYPES itab TYPE|LIKE STANDARD TABLE of line_type
                     INITIAL SIZE 0.

and defines a standard table type with a generic key that can be used to type interface parameters and field symbols.

Overview:

Replacement for Obsolete Statements ABAP Objects