ABAP Runtime Errors

MOVE_CAST_ERROR_DYN SAP ABAP Runtime Error move cast error dyn







MOVE_CAST_ERROR_DYN is an ABAP runtime error which you may come across when using or developing within an SAP system. See below for the standard details explaining what it means and how you can avoid or fix this runtime error.

Short Dump Classification: A - ABAP Programming Error

You can view further information about a runtme error by using transaction code ST22 which will show you this and all runtime erros that have happen in your SAP system.

Also check out the Comments section below to view or add related contributions and example screen shots.


MOVE_CAST_ERROR_DYN ABAP Runtime Error

You need to modify the source code. In a CONSTRUCTOR, you should not attempt to use a CAST to 'get at the subclass'. Dynamic type conflict in assignment of references (special case) Please see abap error for more details about the possible cause of this runtime error and how it could be avoided.

Special case of the 'CAST' operation (CAST in CONSTRUCTOR in inheritances)

A 'CAST' operation ('?=' or 'MOVE ?TO') attempted to associate an object reference or interface reference with a reference variable. The current content of the source variable is not compatible with the target variable however.
Source: Class/interface <runtime parameter>
Aim: Class/interface <runtime parameter>

Normally, CAST would not produce an error, and the instance would be converted to the target type. While the CONSTRUCTOR of an instance is running however, the instance temporarily has the type of the class where this CONSTRUCTOR was defined. This means that the type of the instance changes to the superclasses and then back again. The CAST was executed at the same time, and caused this error.

Description of the special situation:

For example: Class C0 has a method m1, C1 inherits from C0 and has redefined m1 (REDEFINITION). Both classes also have a CONSTRUCTOR. You now use CREATE OBJECT to create a new instance of C1.
The system then first processes the CONSTRUCTOR of C1 which then uses SUPER-> to call the CONSTRUCTOR of C0. If the system now calls method m1 from within the CONSTRUCTOR of C0, m1 of C0 is called instead of m1 of C1. This is to ensure that no methods of an object (of C1) are processed before the CONSTRUCTOR has been completely processed.
While a CONSTRUCTOR is running, the instance has exactly the same type as the class where the CONSTRUCTOR was defined. At this point, no CAST can be executed to a subclass (or in an interface implemented in a subclass). Please see abap error for more details about the possible cause of this runtime error and how it could be avoided.