In the declaration part of the class, the following statement causes an error message::
FIELD-SYMBOLS ...
Correct syntax:
DATA ... TYPE REF TO ...
or
ALIASES ...
Cause:
The only components allowed in classes are attributes, methods, and events. Field symbols
are symbolic names for other fields. They work by means of value semantics. Their role as pointers is now performed in ABAP Objects by reference variables. Their role as symbolic names has now been replaced by aliases.
Error message in ABAP Objects if the following syntax is used:
FIELD-SYMBOLS <fs>.
Correct syntax:
FIELD-SYMBOLS <fs> TYPE ANY.
Reason:
Like method interface parameters, field symbols must alwas have explicit type assignments.
Error message in ABAP Objects if the following syntax is used:
ASSIGN f TO <fs> TYPE ... [DECIMALS ...].
Correct syntax:
ASSIGN f TO <fs> CASTING TYPE|LIKE ...
Reason:
The TYPE and DECIMALS
additions are replaced by the addition CASTING [TYPE|LIKE].
Unlike the TYPE addition, CASTING supports any kind of data types.
Error message in ABAP objects for:
FIELD-SYMBOLS <fs> STRUCTURE struc DEFAULT f.
Correct syntax:
FIELD-SYMBOLS <fs> TYPE|LIKE struc.
ASSIGN f TO <fs> CASTING.
Reason:
Field symbols defined with the STRUCTURE
addition are a mixture of field symbols whose type is defined and a tool for casting on data types defined
in the ABAP Dictionary or locally in the program. The types of field symbols are defined with the
TYPE addition of the FIELD-SYMBOLS
statement and the CASTING addition of the ASSIGN statement can be used for the casting.
Error message in ABAP Objects if the following syntax is used:
ASSIGN LOCAL COPY OF INITIAL f TO <fs>.
ASSIGN LOCAL COPY OF f TO <fs>.
Correct syntax:
DATA dref TYPE REF TO data.
CREATE DATA dref LIKE
f.
ASSIGN dref->* TO <fs>.
DATA dref TYPE REF
TO data.
CREATE DATA dref LIKE f.
ASSIGN dref->* TO <fs>.
<fs> = f.
Reason:
Due to the introduction of the general data references concept, the addition
LOCAL COPY of the statement ASSIGN
is obsolete. The value of f can be copied using the assigment <fs> = f after ASSIGN.
Error message in ABAP Objects in the following case:
ASSIGN TABLE FIELD (<f>) TO <fs>.
Correct syntax:
ASSIGN (<f>) TO <fs>.
Cause:
Table work areas are not supported in classes.