OO ABAP Interview Questions – 2019 Latest Top 51

1. What Is OOPS ABAP?


Object orientation (OO), or to be more precise, object-oriented programming, is a problem-solving method in which the software solution reflects objects in the real world.
A comprehensive introduction to object orientation as a whole would go far beyond the limits of this introduction to ABAP Objects. This documentation introduces a selection of terms that are used universally in object orientation and also occur in ABAP Objects. In subsequent sections, it goes on to discuss in more detail how these terms are used in ABAP Objects. The end of this section contains a list of further reading, with a selection of titles about object orientation.

2. What are the core ABAP oops concepts?


Inheritance: Inheritance is the ability of an object to inherit the properties and methods of another object. This characteristic leads to the creation of families of objects (just like families exist for humans) with parent objects and child objects.
Polymorphism: Polymorphism is about an objects ability to provide context when methods or operators are called on the object.

3. What is a reference variable?


Objects can only be created and addressed using reference variables. Reference variables allow you to create and address objects. Reference variables can be defined in classes, allowing you to access objects from within a class.

4. What are the limitations of redefining a method?


Inherited methods can be redefined in subclasses Redefined methods must be re-implemented in subclasses. The signature of redefined methods cannot be changed Static methods cannot be redefined. In inheritance, static components are “shared”: A class shares its non-private static attributes with all its subclasses. In ABAP Objects, you can not only add new components, but also provide inherited methods with new implementations. This is known as redefinition. You can only redefine (public and protected) instance methods, other components (static methods, attributes and so on) cannot be redefined. Changes to method parameters (signature changes) are not possible.

5. What Is A Singleton Class In Ooabap?


Singleton class is a class which allows to instantiate(Create Object) only.

6. What Are The Advantages Of Oo Alv?


Some of the main advantages of Object Oriented ALV

We have no of events available in the classes when compared to ALV with function modules which gives flexibility for the programmer to develop ALV’S for various scenarios.
We can display more than one ALV grid data on a single screen.
The ALV grid data is displayed in the form of custom container with which we can control the size of ALV grid Whereas we cannot control the size of the ALV with function Modules.
We can also place different UI elements like checkbox, Radiobutton on the same screen in addition ALV grid data.

7. What Are The Differences Local & Global Classes? Answer: Local classes are defined locally with in a program and the other programs can’t access the same classes directly. But global classes are not like that they are globally accessible from ABAP environment. Global classes are centrally defined in a repository. Transaction code for global classes is SE24(class builder). (OO ABAP Interview Questions)

8. Can We Instantiate Abstract Class In Ooabap?


we cannot create an object to the abstract class instead create an object to the child class and call the methods .
Abstract class are mainly used for creating inheritance.

9. What Is A Class In Ooabap?


Class is user defined data type which contains methods, events, attributes, interfaces etc.

10. What Is The Difference Between Abstract Class And Interface?


Abstract class is a class which contains at least one abstract method( Method without implementation), Abstract class contains methods with implementation and without implementation and we cannot create instance for the abstract class Abstract class is mainly for inheritance .
Interface contains methods without implementation.

11. Is It Mandatory To Implement All Methods Of Interface In The Class Which Includes Interface?


No it is not mandatory to implement all normal interface methods but it is mandatory to implement all Abstract methods.

12. What Is An Abstract Class In Ooabap?


It is a class which contains methods with implementation as well as methods without implementation .
Abstract class is a class which contains at least one abstract method.

13. What Is A Polymorphism In Ooabap?


Polymorphism is a concept by which the same method names will behave differently in different classes i.e each method will have it’s own implementation in different classes but with the same name.

14. What Is The Difference Between Function Group And Classes?


We can create many instances of the same class with in a program, but we cannot create many instances of function group.



Interface is class which contains methods without implementations. (OO ABAP Interview Questions)

16. What Are The Types Of Constructor’s In Ooabap? Explain?


CONSTRUCTOR’s are special type of methods, constructor method is executed automatically whenever a object is created or instantiated.

Constructor: This method is executed automatically whenever object is created, this is used to set default values with respect to instance/object. The name of the constructor method is CONSTRUCTOR.
Static Constructor: This method is executed automatically whenever object is created, this is used to set default values globally irrespective of instances/objects.The name of the static constructor is CLASS_ CONSTRUCTOR.

17. What is Encapsulation in Object Oriented Programming(OOP)?


Encapsulation is the main concept in OOP. Encapsulation means hiding attributes and methods from outside world, so by this way we can restrict the visibility of object( an instance of a class) components(attributes and methods).

18. What is Inheritance in OO ABAP?


Deriving a new class from an existing class in called as Inheritance.Existing class is called as Super class and derived new class is called as Sub class.Derived class get all attributes and methods from the super class and in addition to that we create new attributes and methods.

19. What is Narrow Casting?


Definition: The assignment of a subclass instance to a reference variable of the type “reference to super class” is described as a narrowing cast, because you are switching from a more detailed view to a one with less detail. It is also called as up-casting.
Use of narrowing casting:
A user who is not interested in the finer points of cars, trucks, and busses (but only, for example, in the fuel consumption and tank gauge) does not need to know about them. This user only wants and needs to work with (references to) the lcl_vehicle(super class) class. However, in order to allow the user to work with cars, busses, or trucks, you generally need a narrowing cast.
Principle of narrowing casting:
1. In narrowing casting the object which is created with reference to the sub class is assigned to the reference of type super class.
2. Using the super class reference it is possible to access the methods from the object which are only defined at the super class.
3. This access is also called as generic access as super class is normally called as general class.

20. What is abstraction,encapsulation and polymorphism?


Abstraction: Everything is visualized in terms of classes and objects.

Encapsulation The wrapping up of data and methods into a single unit (called class) is known as Encapsulation. The data is not accessible to the outside world only those methods, which are wrapped in the class, can access it.

Polymorphism: Methods of same name behave differently in different classes. Identical(identically-named) methods behave differently in different classes. Object-oriented programming contains constructions called interfaces. They enable you to address methods with the same name in different objects. Although the form of address is always the same, the implementation of the method is specific to a particular class.

21. What Is Alias Name In Ooabap? Answer: Alias is an alias name for the interface method implemented in the class. (OO ABAP Interview Questions)

22. How do you achieve encapsulation in OO ABAP?


We can achieve encapsulation in OO ABAP by using PUBLIC, PRIVATE and PROTECTED keywords in OO ABAP.These are also called as access specifiers.

23. What is Event Handler Technique in Object oriented ABAP?


Event is a mechanism by which method of one class can raise method of another class, without the hazard of instantiating that class. It provides to raise the method (event handler method) of one class with help of another method in the same or different class (triggering method).
The below steps is required to have the event handler in the class:-
• Create an event in a class.
• Create a triggering method in the same class which will raise the event.
• Create an event handler method for the event in same/other class.
• Register the event handler method in the program.
Now, the above settings are complete for event handler in class. Create an object from the class containing the event and call the triggering method to raise the event.

24. What is Method Overriding?


Method overriding allows a subclass to override a specific implementation of a method that is already provided by one of its super classes.
A subclass can give its own definition of methods but need to have the same signature as the method in its super class. This means that when overriding a method the subclass’s method has to have the same name and parameter list as the super class’s overridden method.

25. What is UML?


UML (Unified Modeling Language) is a standardized modeling language. It is used for the specification, construction, visualization and documentation of models for software systems and enables uniform communication between various users.
UML does not describe the steps in the object-oriented development process.
SAP uses UML as the company-wide standard for object-oriented modeling.
UML describes a number of different diagram types in order to represent different views of a system.

26. How polymorphism can be implemented?


Some examples to implement polymorphism:

  • Method Overriding
  • Method Overloading
  • Operator Overloading
27. What Is The Difference In Attributes Defined In The Public Versus Private Section Of A Class? Answer: Public attributes can be accessed by class, subclasses and other classes where as Private attributes can be accessed by class itself only. (OO ABAP Interview Questions)

28. What are Abstract Classes and Methods in Object Oriented Programming?


Abstract Class: Classes which contain one or more abstract methods or abstract properties, such methods or properties do not provide implementation. These abstract methods or properties are implemented in the derived classes (Sub-classes).
Abstract classes does not create any instances to that class objects

Use of Abstract class: We can define some common functionality in Abstract class (Super-class) and those can be used in derived classes (Sub classes).

29. What is Visibility of Component?


Each class component has a visibility. In ABAP Objects the whole class definition is separated into three visibility sections: PUBLIC, PROTECTED, and PRIVATE.

1) Data declared in public section can be accessed by the class itself, by its sub-classes as well as by other users outside the class.
2) Data declared in the protected section can be accessed by the class itself, and also by its sub-classes but not by external users outside the class.
3) Data declared in the private section can be accessed by the class only, but not by its sub-classes and by external users outside the class.

30. What is the Difference between Class and Object?


A Class is actually a blueprint or a template to create an Object. Whereas an Object is a an actual instance of a Class. For example Employee ia a class, while John is a real employee which is an Object of Employee Class.

31. What is Inheritance?


In OOPs terminology, inheritance is a way to form new classes using classes that have already been defined. Inheritance is intended to help reuse existing code with little or no modification. The new classes, known as derived classes, inherit attributes and behavior of the pre-existing classes, which are referred to as base classes.

32. What is object oriented programming language?


Object oriented programming language allows concepts such as abstraction, modularity, encapsulation, polymorphism and inheritance. Simula is the first object oriented language. Objects are said to be the most important part of object oriented language. Concept revolves around making simulation programs around an object.

33. What are the types of Objects and Classes?


In general there are two types of Objects: Instance Object and Static Object and as such there are two types of Classes: Instance class and Static Class. Specifically when it comes to visibility, Private class, Protected class and Public classes are the types of classes one can have.

34. What is the difference between Abstract method and a Final method?


Abstract method
Abstract instance methods are used to specify particular interfaces for subclasses, without having to immediately provide implementation for them. Abstract methods need to be redefined and thereby implemented in the subclass (here you also need to include the corresponding redefinition statement in the DEFINITION part of the subclass). Classes with at least one abstract method are themselves abstract. Static methods and constructors cannot be abstract (they cannot be redefined).
Abstract (instance) methods are defined in the class, but not implemented
They must be redefined in subclasses.

35. How is Encapsulation implemented in OOPs?


Encapsulation means that the implementation of an object is hidden from other components in the system, so that they cannot make assumptions about the internal status of the object and therefore dependencies on specific implementations do not arise. (OO ABAP Interview Questions)

36. What Is An Event In Ooabap?


Event is a mechanism by which method of one class can raise method of another class, without the hazard of instantiating that class.

37. What Is A Constructor Method In Ooabap?


  • These are special type of methods constructor method is executed automatically whenever a object is created or instantiated
  • These methods are mainly used to set default values in a class
  • The name of the constructor method is ‘constructor’
  • These methods have only importing parameters
  • There are no exporting parameters.

38. Can We Defined A Class Without A Constructor In Ooabap


Yes, class can be created without any constructor. Default constructor will be created when we define a class without constructor.

39. How To Create An Object For Private Class?


In general we can not create object for a private class, but we can access static method of a private class so call that method using its class name and import that object.
For example take one static method with an exporting parameter inside private class and write object creation code in that static method and export that object.

40. What Is The Difference Between Singleton And Static Class In Sap Abap?


Before going to static classes, you should understand static components.

Static Components: Static components (static attributes, static events and static methods) exists globally, no need to create object/instance of the class to access them, we can access them by using static component selector => .
Static Class: A class that only contains static components and no instance components is referred to as a static class.
Singleton Class: It is a class which does not allow you to create multiple instances.

41. What is a de-referenced variable ? What is a garbage collector?


To go to an address before performing the operation a dereference variable is a pointer to the variable, not the variable itself. A pointer can be re-assigned any number of times while a reference cannot be reassigned after initialization. Field symbols are similar to dereference pointers. Thus, you can only access the content of the data object to which the field symbol points. (That is, field symbols use value semantics). If you want to access the content of the data object, you need to dereference the data reference first.

42. How Many Types Of Classes Are There In Ooabap?


  • Public class
  • Private class
  • Final class
  • Single­ton class
  • Abstract class
  • Persistent class
  • Friend class.

43. What are different components available in Clas?


Attributes, Methods, Events, Types and Constants are different components which are available in Class. (OO ABAP Interview Questions)

44. What are principles of Object Oriented Programming(OOP)?


There are 4 major principles in OO Programming. They are of Abstraction, Encapsulation, Inheritance and Polymorphism.

45. What are Instance and Static Components?


Instance components: These components exist separately in each instance (object) of the class and are referred using instance component selector using ->
Static components: These components exists globally for a class and are referred to using static component selector.

46. What is a Narrowing Cast ? How can you implement it?


The assignment of a subclass instance to a reference variable of the type “reference to superclass” is described as a narrowing cast, because you are switching from a more detailed view to a one with less detail.

47. What is Method Overloading?


Method overloading is in a class have many methods having same name but different parameter called overloading or static polymorphism.

48. What is FRIENDS keyword?


In any Object Oriented programming language, the access to private or protected components – both methods and attributes – would be prohibited. If someone try to access them, compiler would generate syntax error.
Sometimes, it would be advantageous to give the access to these protected and private attributes to other classes. This can be achieved using the FRIENDS addition.

49. How To Declare And Raise Events In Ooabap?


We need to follow below steps when working with events in Object Oriented ABAP:

  • Define an event
  • Define a method
  • Link event and method and convert the method into event – handler method
  • Create a triggering method which will raise the event Use set
  • handler and register event handler method to a particular instance in the program

50. What is Use of final class?


Final Classes and Methods in Object Oriented Programming

Final Class: A class that is defined as final class can not be inherited further. All Methods of a final class are inherently final and must not be declared as final in the class definition. Also a final method can not be redefined further.
If only a method of a class is final then that class can be inherited but that method cannot be redefined.

If you don’t want anyone else to change or override the functionality of your class then you can define it as final. Thus no one can inherit and modify the features of this class.

Leave a Comment

Your email address will not be published. Required fields are marked *