Visibility of Methods in Global Classes

By Anil Bharadwaj, OpenText Technologies

This is a very basic example in the OO concepts in ABAP. In this example we deal with the visibility of classes and how we can use them in our Custom Programs and how a constructor and Friend Function work along with inheritance using Global Classes.

Create Global Class in Transaction code SE24.

Select the type as Class

Make the class as Public

Here in the class I had created 4 methods with visibility as public, private, protected and a static method.

We have 2 Levels options and 3 types Visibilities while creating Methods


1. Instance method: For these methods we have to create object i.e. Instance while using the class in the program. We can have any number of Instances of a class in a program.

2. Static method: For these we no need to create an object i.e. Instance, directly we can use the method with the class name. this does not support polymorphism and has many functionalities which are not needed at this stage.


 Public: These methods are accessible trough out the program with instances and for subclasses and friends.

 Private: These Methods can be used only within the class where it is declared like the other methods of the class and these methods cannot be used with object reference from your Z Programs.

Below is the screen of the code of the public method which is using the private and protected methods of its own class.

Now I had created another class which inherits the above class. You can see the super class name.

Click here to continue...

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image