Ansicht
Dokumentation

ABENCONVERSION_REFERENCES_DATA - CONVERSION REFERENCES DATA

ABENCONVERSION_REFERENCES_DATA - CONVERSION REFERENCES DATA

PERFORM Short Reference   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

Assignments Between Data Reference Variables

Data reference variables are either completely typed or typed with the generic type data.

Upcasts in Data References

An upcast in data references is possible in the following cases:

  • The static types of the source variable and the target variable match according to the following rules:
  • Both are elementary data types with identical technical type attributes, namely the built-in ABAP type, length, and number of decimal places. It is not important how the static types were defined.

  • Both have an identical structured type. In the case of structured types, identical technical type attributes are not sufficient, but the same structured type must have been used to define the static types.

  • Both are table types with matching technical type attributes, that is, line types, table category, and table key. In the case of non-structured line types, identical technical attributes of the line type are sufficient. In the case of structured line types, both definitions must have been made with reference to the same structured type.

  • The static type of the source variable is completely typed, and the static type of the target variable is generic.

Note

With respect to checks on static types, structured types behave like classes. Two differently structured types do not match, even if they consist of identical components.

Downcasts in Data References

A downcast in data references is only possible if the static type of the source variable is generic and that of the target variable is completely typed. The syntax check makes it impossible for static types of the source variable and the target variable to be completely typed, but not identical at the same time.

The assignment from dref1 to dref2 is an upcast. The assignment from dref2 to dref1 is a downcast, which in the example below raises an exception. If the statement CREATE DATA had the addition TYPE i, the downcast would also have been successful.






ABAP Short Reference   Vendor Master (General Section)  
This documentation is copyright by SAP AG.

Length: 2754 Date: 20240424 Time: 204827     sap01-206 ( 47 ms )