Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

How To Create An Object For Private Class?

Answer»

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.

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.

2.

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.­­­­­­
Endmethod.
Endclass

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.­­­­­­
Endmethod.
Endclass

3.

How Many Types Of Classes Are There In Ooabap?

Answer»

4.

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.

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

5.

What Are The Differences Local &amp; 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).

6.

How To Call A Method?

Answer»

CALL METHOD ref­&GT;method_name .

Call method ref­>method_name .

7.

How To A Create Object For The Class?

Answer»

DATA: REF TYPE ref to .
CREATE OBJECT ref.

Data: ref type ref to .
Create object ref.

8.

How To Create A Global Class?

Answer»

With TCODE SE24.

With tcode SE24.

9.

What Is Me Variable?

Answer»

It just like a self­reference, by this we can call methods that are with in same CLASS with out CREATING OBJECT.

It just like a self­reference, by this we can call methods that are with in same class with out creating object.

10.

What Is A Friend Class?

Answer»

FRIEND class is a class it can ACCESS PRIVATE components of it’s FRIENDS class.

Friend class is a class it can access private components of it’s friends class.

11.

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.

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

12.

What Is A Polymorphism In Ooabap ?

Answer»

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.

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.

13.

What Are The Types Of Constructor's In Ooabap ? Explain ?

Answer»

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.

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

14.

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, RADIOBUTTON on the same screen in addition ALV grid data.

Some of the main advantages of Object Oriented ALV

15.

What Is The Use Of 'defination 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.

It is the keyword which indicates the class definition is delayed or postponed or Defined at some place in program.

Syntax : CLASSÂ Â DEFINITION DEFERED.

16.

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.

17.

What Is An Abstract Class In Ooabap ?

Answer»

18.

What Is Abstract Method In Ooabap ?

Answer»

ABSTRACT METHODS is a METHOD which doesn't CONTAIN any IMPLEMENTATION.

Abstract methods is a method which doesn't contain any implementation.

19.

What Is A Constructor Method In Ooabap ?

Answer»
  • 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

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

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

21.

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.

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

22.

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.

Local classes are defined in an ABAP program (Transaction SE38) and can only be used in the program in which they are defined.

23.

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

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

24.

What Is A Singleton Class In Ooabap ?

Answer»

SINGLETON CLASS is a class which allows to instantiate(Create OBJECT) only once .

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

25.

Can We Declare Events In Interface In Ooabap ?

Answer»

Yes, we can declare events in INTERFACE in OBJECT Oriented ABAP

Yes, we can declare events in interface in Object Oriented ABAP

26.

Can We Make Methods Of Interface As Abstract And Final In Ooabap ?

Answer»

No we can not make interface METHODS as ABSTRACT or final in OBJECT ORIENTED ABAP

No we can not make interface methods as abstract or final in Object Oriented ABAP

27.

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.

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

28.

What Is A Class In Ooabap?

Answer»

CLASS is USER DEFINED data type which CONTAINS methods, EVENTS, attributes, interfaces etc.

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

29.

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.

Instance method is available separately in each object (instance), static method is global and no instance is required for static method.

30.

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.

Public attributes can be accessed by class, subclasses and other classes where as Private attributes can be accessed by class itself only.

31.

What Is A Single-ton Class?

Answer»

Single-ton CLASS is a class which ALLOWS to INSTANTIATE once only .

Single-ton class is a class which allows to instantiate once only .

32.

Can We Raise Events In Interface?

Answer»

No, you can not RAISE EVENTS in interface, Because there is no Implementation for the methods. We can CREATE events in INTERFACES .

No, you can not raise events in interface, Because there is no Implementation for the methods. We can create events in interfaces .

33.

What Is Alias Name In Ooabap?

Answer»

ALIAS is an alias NAME for the INTERFACE METHOD IMPLEMENTED in the class .

Alias is an alias name for the interface method implemented in the class .

34.

Does Polymorphism Achieved Through Interfaces?

Answer»

Yes, by USING INTERFACE CONCEPT in SAP ABAP, we can polymorphism

Yes, by using interface concept in SAP ABAP, we can polymorphism

35.

Can We Achieve Multiple Inheritance Using Interfaces?

Answer»

Yes, by USING INTERFACE concept in SAP ABAp, we can ACHIEVE multiple inheritance

Yes, by using interface concept in SAP ABAp, we can achieve multiple inheritance

36.

Can We Instantiate The Interface?

Answer»

No, we can not INSTANTIATE INTERFACE using create OBJECT keyword.

No, we can not instantiate interface using create object keyword.

37.

What Is An Interface In Ooabap?

Answer»

Interface is CLASS which CONTAINS methods without IMPLEMENTATIONS.

Interface is class which contains methods without implementations.

38.

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.

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