Cannot Use LIKEReference to Dictionary Types

In classes, you can only use a TYPE reference to data types in the ABAP Dictionary. The LIKEreference can only be used for local data objects. This also covers the attributes of the class and the data objects of the main program. In global classes, you can only make a reference to the attributes of the class. This applies to data declarations and the typing of interface parameters or field symbols.

In ABAP Objects, the following statement causes an error message:

DATA f LIKE dbtab.

Correct syntax:

DATA f TYPE dbtab.

Cause:

The TYPE addition should be the only construction that allows a reference to data types, while the LIKE addition should only be used for data objects. The Repository objects in the ABAP Dictionary are data types, not data objects. Outside the ABAP Objects context, the LIKE reference to database tables and flat structures in the ABAP Dictionary is still allowed for compatibility reasons.

Overview:

Replacement for Obsolete Statements ABAP Objects