Skip to Content
Former Member
Jul 22, 2005 at 09:20 AM

ABAP OBJECTS: Dynamic Create object


Hi folks!

I have a problem... I need to create a dynamic type object with:

<b>DATA: my_instance TYPE REF TO class1.

CREATE OBJECT my_instance TYPE (class2).</b>

<i>* where class1 is a superclass of class2.</i>

When I do:

<b>my_instance ?= m_parent.</b>

<i>* where m_parent is an instance of class1</i>

My problem is when I want to access to an attribute of the class2, the compiler says that it cannot find the attribute <i>(this is OK, because the attribute is only in the class2).</i>

My question:

Is there anyway to access to an atribute of second class when is not in the first class? (i don't want to create the attribute as an attribute of the first class).