Skip to Content
Former Member
Aug 09, 2006 at 08:00 AM

Hook methods in ABAP Objects



i discovered that method calling in the class-inheritance of ABAP Objects doesn't work similar to other OO languages.


1 Superclass named "Z_CLASS"

1 Subclass of "Z_CLASS" named "Z_SUB"

Z_CLASS defines a method "initialize" and has a constructor which calls "initialize".

Z_SUB redefines the method "initialize" assigning some values to instance-attributes.

If i instantiate a new "Z_SUB"-object then the contructor of "Z_CLASS" is called which calls ITS OWN "initialize" not the one of the subclass. For comparison: Java would call the initialize of the subclass.

I have to implement a constructor in every subclass of "Z_CLASS" which calls the super constructor and the own "initialize" after that to solve this problem. This isn't the proper OO way!

Did i miss something or am i right?

Thanks in advance,