Skip to Content
0
Former Member
Jun 04, 2009 at 09:41 AM

Need help to cast

62 Views

Hi all,

i need some help.

I need to create a new method in class CL_PO_ITEM_HANDLE_MM, so i have created a new class named Z_CL_PO_ITEM_HANDLE_MM and inherited from CL_PO_ITEM_HANDLE_MM class and add a method name CHECK_ASSIGNMENT.

Now i would like to call this method ; in my BADI the CL_PO_ITEM_HANDLE_MM class is used so i wanted to cast CL_PO_ITEM_HANDLE_MM class to Z_CL_PO_ITEM_HANDLE_MM like this :

my_instance ?= standard-instance.

The code is compiled well but when i execute this code i get a dump with this message :

Dynamic type conflict when assigning references

It was tried to assign a reference to a rereference variable using the

'CAST' operation ('?=' or 'MOVE ?TO').

However, the current content of the source variable does not fit into

the target variable.

So i can't do that ? if not how can i resolve my problem ?

Thanks for your help.

Cheers

source type: "\CLASS=CL_PO_ITEM_HANDLE_MM"

target type: "\CLASS=Z_CL_PO_ITEM_HANDLE_MM"