0% found this document useful (0 votes)
9 views

SAP OOABAP Q&A

The document provides a comprehensive list of interview questions and answers related to Object-Oriented ABAP (OoABAP). It covers key concepts such as interfaces, abstract classes, singleton classes, polymorphism, and event handling, along with their definitions and differences. Additionally, it discusses the advantages of Object-Oriented ALV and the process of creating classes and objects in SAP ABAP.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

SAP OOABAP Q&A

The document provides a comprehensive list of interview questions and answers related to Object-Oriented ABAP (OoABAP). It covers key concepts such as interfaces, abstract classes, singleton classes, polymorphism, and event handling, along with their definitions and differences. Additionally, it discusses the advantages of Object-Oriented ALV and the process of creating classes and objects in SAP ABAP.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

OOPS ABAP - Interview Q & A

1. Is It Mandatory to Implement All Methods of Interface in The Class


Which Includes Interface?
Answer:
No, it is not mandatory to implement all normal interface methods but it is
mandatory to implement all Abstract methods.
2. What Is an Interface in Ooabap?
Answer:
Interface is class which contains methods without implementations.
3. Can We Instantiate the Interface?
Answer:
No, we can’t instantiate interface using create object keyword.
4. Can We Achieve Multiple Inheritance Using Interfaces?
Answer:
Yes, by using interface concept in SAP ABAP, we can achieve multiple inheritance
5. Does Polymorphism Achieved Through Interfaces?
Answer:
Yes, by using interface concept in SAP ABAP, we can polymorphism
6. What Is the Difference Between Abstract Class and Interface?
Answer:
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.
7. What Is Alias Name in Ooabap?
Answer:
Alias is an alias name for the interface method implemented in the class.
8. Can We Raise Events in Interface?
Answer:
No, you can’t raise events in interface, because there is no Implementation for
the methods. We can create events in interfaces.
9. What Is A Single-ton Class?
Answer:
Single-ton class is a class which allows to instantiate once only.
10. 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.
11. What Is the Difference in An Instance Method and A Static Method?
Answer:
Instance method is available separately in each object (instance), static method
is global and no instance is required for static method.
12. What Is A Class in Ooabap?
Answer:

1
Class is user defined data type which contains methods, events, attributes,
interfaces etc.
13. What Is the Difference Between Singleton and Static Class in Sap
Abap?
Answer:
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.
14.Can We Make Methods of Interface as Abstract and Final in Ooabap?
Answer:
No, we can’t make interface methods as abstract or final in Object Oriented ABAP
15. Can We Declare Events in Interface in Ooabap?
Answer:
Yes, we can declare events in interface in Object Oriented ABAP
16. What Is A Singleton Class in Ooabap?
Answer:
Singleton class is a class which allows to instantiate (Create Object) only once.
17. What Is A Global Class in Sap?
Answer:
Global classes and interfaces are defined in the Class Builder (Transaction SE24)
in the ABAP Workbench. All of the ABAP programs in an R/3 System can access
the global classes
18. What Is A Local Class in Sap?
Answer:
Local classes are defined in an ABAP program (Transaction SE38) and can only be
used in the program in which they are defined.
19. What Is an Event in Ooabap?
Answer:
Event is a mechanism by which method of one class can raise method of another
class, without the hazard of instantiating that class.
20. How to Declare and Raise Events in Ooabap?
Answer:
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
21. What Is A Constructor Method in Ooabap?
Answer:These are special type of methods

2
constructor method is executed automatically whenever an 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
22. What Is Abstract Method in Ooabap?
Answer:
Abstract methods are a method which doesn't contain any implementation.
23. What Is an Abstract Class in Ooabap?
Answer:
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.
24. Can We Instantiate Abstract Class in Ooabap?
Answer:
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.
25. What Is the Use Of 'definition Deferred' Keyword in Ooabap?
Answer:
It is the keyword which indicates the class definition is delayed or postponed or
Defined at some place in program.
Syntax: CLASSÂ Â DEFINITION DEFERED.
26. What Are the Advantages of Oo Alv?
Answer:
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, Radio button on the
same screen in addition ALV grid data.
27. What Are the Types of Constructor's in Ooabap? Explain?
Answer:
CONSTRUCTOR's are special type of methods; constructor method is executed
automatically whenever an 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.
28. What Is A Polymorphism in Ooabap?

3
Answer:
Polymorphism is a concept by which the same method names will behave
differently in different classes i.e. each method will have its own implementation
in different classes but with the same name.
29. Can We Defined A Class Without A Constructor in Ooabap?
Answer:
Yes, class can be created without any constructor. Default constructor will be
created when we define a class without constructor.
30. What Is A Friend Class?
Answer:
Friend class is a class it can access private components of its friends’ class.
31. What Is Alias?
Answer:
Instead of specifying full name of interface methods, we can assign it a
name which can directly trigger.
32. What Is Me Variable?
Answer:
It just like a self reference, by this we can call methods that are within same
class without creating object.
33. How to Create A Global Class?
Answer:
With T-Code SE24.
34. How to A Create Object for The Class?
Answer:
Data: ref type ref to.
Create object ref.
35. How to Call A Method?
Answer:
Call method ref>method name.
36. 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).
37. What Is the Difference Between Function Group and Classes?
Answer:
We can create many instances of the same class with in a program, but we
cannot create many instances of function group.
38. How Many Types of Classes Are There in Ooabap?
Answer:
Public class
Private class
Final class
Singleton class

4
Abstract class
Persistent class
Friend class
39. How to Define A Class Locally?
Answer:
class <cl_name> definition.
Public section.
Methods: m1 importing p1 type <c>
Exporting p2 type <i>
Changing p3 type <n>
Returning p4 type <i>
Exceptions <e1>.
Protected section.
Private section.
Endclass.
Class <c1_name> implementation.
Method m1.
End method.
End class
40. How to Create an Object for Private Class?
Answer:
In general, we cannot 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.

You might also like