Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

help with "...empty class OBJECT"

Former Member
0 Kudos

In the NW AS ABAP 7.1.1 documentation it says...

The root node of all inheritance trees in ABAP Objects is the predefined empty class object. This class is the most generic class because it does not contain attributes or methods. When you define a new class, you must not explicitly specify this class as a superclass because it always exists implicitly.

I am confused about this "empty class OBJECT" that "exists implicitly". Would like help in understanding what I need to do / not do in regards to this entity.

I create a new class in SE24 with 2 abstract methods and then would like to create two sub-classes that inherit from the root class and redefine the abstract methods in addition to other methods.

What does the existance of this "empty class OBJECT" mean to me? Can I look at it? Do I need to do anything with it? Would appreciate any insight on this subject and if you can point me to further reading material, would be appreciated.

Thank you,

Dean Atteberry.

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

No, You don't have to do anything regarding the OBJECT class.

You simple create a Superclass with installation "Abstract", without any Superclass. Create your two abstract methods in it.

Now inherite your Subclasses from this SuperClass and redefine your abstract methods.

Online Help Says:

Every class without the INHERITING FROM addition inherits implicitly from the predefined empty, abstract class object. All classes in ABAP Objects form an inheritance tree, in which there is a unique path from each class to the root object object.

So, techanically your Superclass (which is abstract) is inherited from the most generic OBJECT class. Since OBJECT class has no properties, we will not see any difference in our Superclass.

Check the inheritence tree of the SALV model calss CL_SALV_TABLE. Go to SE24 with this class. Drilldown on the Super Class in properties till you see no SuperClass, you will see this inheritence tree and notice that, there is no generic OBJECT class in this tree.


CL_SALV_MODEL 
  '--- CL_SALV_MODEL_BASE
        '--- CL_SALV_MODEL_LIST
              '--- CL_SALV_TABLE

Regards,

Naimesh Patel

2 REPLIES 2

naimesh_patel
Active Contributor
0 Kudos

No, You don't have to do anything regarding the OBJECT class.

You simple create a Superclass with installation "Abstract", without any Superclass. Create your two abstract methods in it.

Now inherite your Subclasses from this SuperClass and redefine your abstract methods.

Online Help Says:

Every class without the INHERITING FROM addition inherits implicitly from the predefined empty, abstract class object. All classes in ABAP Objects form an inheritance tree, in which there is a unique path from each class to the root object object.

So, techanically your Superclass (which is abstract) is inherited from the most generic OBJECT class. Since OBJECT class has no properties, we will not see any difference in our Superclass.

Check the inheritence tree of the SALV model calss CL_SALV_TABLE. Go to SE24 with this class. Drilldown on the Super Class in properties till you see no SuperClass, you will see this inheritence tree and notice that, there is no generic OBJECT class in this tree.


CL_SALV_MODEL 
  '--- CL_SALV_MODEL_BASE
        '--- CL_SALV_MODEL_LIST
              '--- CL_SALV_TABLE

Regards,

Naimesh Patel

Former Member
0 Kudos

Hello Dean,

You don't have to do anything with this remark.It just means that if you go up in any inheritance tree of classes you will always end up in the root class OBJECT. This class however is not visible in the system and is of no relevance as this class is internally used only and empty.

So go on and create your own classes with their subclasses and don't worry about this internal class!

Regards,

John.