Ansicht
Dokumentation

ABAPFIELD-SYMBOLS_OBSOLETE_TYPING - FIELD-SYMBOLS OBSOLETE TYPING

ABAPFIELD-SYMBOLS_OBSOLETE_TYPING - FIELD-SYMBOLS OBSOLETE TYPING

General Material Data   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

FIELD-SYMBOLS, obsolete_typing

Short Reference



... ${ $} $| STRUCTURE struc DEFAULT dobj ...

Additions

1. ... ${ $}

2. ... STRUCTURE struc DEFAULT dobj

Effect

These additions of the statement FIELD-SYMBOLS produce an obsolete typing of the field symbol and are forbidden in classes.

Addition 1

... ${ $}

Effect

If no explicit type is specified after FIELD-SYMBOLS, the field symbol is typed implicitly with the completely generic type any. Furthermore, the field symbol is assigned the predefined constant space when the context is loaded. This means that the field symbol is not initial directly after it has been declared, and a check using IS ASSIGNED is true.

Addition 2

... STRUCTURE struc DEFAULT dobj

Effect

If the addition STRUCTURE, which is forbidden within classes, is specified for a field symbol instead of typing and struc is a local program structure (a data object, not a data type) or a flat structure from the ABAP Dictionary, this structure is cast for the field symbol <fs>. dobj must be used to specify a data object that is assigned to the field symbol as an initial object.

The field symbol inherits the technical attributes of structure struc, as with complete typing. In the case of a structured data object dobj, this data object must be at least as long as the formal parameter:

  • In the case of a structured data object, its fragment view must match the fragment view of the corresponding initial part of struc.
  • An elementary data object must be character-like and flat and the corresponding initial part of struc can contain only components of this type.

The same applies to assignments of data objects to field symbols typed using STRUCTURE when using the statement ASSIGN.

Note

Field symbols declared using the addition STRUCTURE are a mixture of typed field symbols and a tool for casting to structured data types. The additions TYPE or LIKE of the statement FIELD-SYMBOLS should be used to type field symbols, while the addition CASTING of the statement ASSIGN is used for casting.

Example

The first example shows the obsolete use of the addition STRUCTURE.

The second example shows the replacement of STRUCTURE with the additions TYPE and CASTING.

Field Symbols, Cast Structures






RFUMSV00 - Advance Return for Tax on Sales/Purchases   Vendor Master (General Section)  
This documentation is copyright by SAP AG.

Length: 3952 Date: 20240425 Time: 094245     sap01-206 ( 65 ms )