Dec 18, 2015

SAP ABAP FAQs- Part 3 (Object Oriented ABAP)

SAP OOABAP Interview Questions Answers

1. Explain about Object oriented programming?

Object oriented programming is one of the most popular methodologies in
software development. It offers a powerful model for creating computer programs.
It speeds the program development process, improves maintenance and enhances
Reusability of programs.

2. Object oriented Concepts?

Encapsulation:
It means combining data and code that acts up on data into one single unit of
organization, so that both are safe from out side interference. In OOAbap
encapsulation is achieved through classes.

Polymorphism:
It means many forms that mean the same method behaves differently in different
method calls.

Inheritance:
It means deriving a child class from base class; child class acquires all the
properties from base class.

Abstraction:
Abstraction simplifies a complex problem to a simpler problem by specifying and
modeling the class to the relevant problem scenario.
It simplifies the problem by giving the class its specific class of inheritance.
Composition also helps in solving the problem to an extent.

3. What is a class?

Classes are templates for objects. Conversely, you can say that the type of an
object is the same as its class. A class is an abstract description of an object.
You could say that it is a set of instructions for building an object. The attributes
of objects are defined by the components of the class, which describe the state
and behavior of objects.

4. What is an object?

An object is a combination of messages and data. Objects can receive and send
messages and use messages to interact with each other. The messages contain
information that is to be passed to the recipient object.

5. How many types of classes are there in OOABAP?

Public class
Private class
Final class
Singleton
class
Abstract class
Persistent class
Friend class

6. 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.

7. What are the differences local & global classes?

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).

8. What are the Components of a class?

Attributes and methods are components inside a class.

9. How to define a class locally?

class definition.
Public section.
Methods: m1 importing p1 type
Exporting p2 type
Changing p3 type
Returning p4 type
Exceptions .
Protected section.
Private section.
Endclass.
Class implementation.
Method m1.
Endmethod.
Endclass.

10. What is a constructor & types of constructors?

Constructor is a special method, which will be called automatically as and when
the object is created for a class, it can have only importing parameters but not
exporting, it is generally used to give some initial state to the object.
A class can contain have two types of constructors static and instance
constructors.

11. Difference between static and instance constructors?

Static constructor will be called only once, i.e. at the time of loading class in to
memory. Instance constructors are instance specific, these constructors will be
called as and when the new object is created for that class.

12. How to a create object for the class?

Data: ref type ref to .
Create object ref.
13. how to call a method?
Call method ref>
method_name .

14. What is static attribute & method?

Static attributes & methods are class specific, memory will be allocated only once
for Static attributes & methods irrespective of no. of objects created.
We can access the components with a reference variable i.e. by using class name
Call method =>menthod_name.

15. Can we instantiate a class within implementation of other class?
Yes
16. Can we put non declarative statement e.g. STARTOFSELECTION
within a class?

No, we can’t use.

17. How to create a global class?

With tcode SE24

18. How can we pass importing parameter?

Pass by value/pass by reference

19. Can we pass returning parameter by reference?

NO, only pass by value

20. Can a method call itself?
Yes

21. What is me variable?

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

22. Can we have export parameter in Instance constructor? No

23. What is an abstract class?

Abstract class contains both abstract methods and normal methods, abstract
methods cannot implement in side abstract class, and instead these methods will
be implemented by child classes of that abstract class.

24. What is final class & Method?

Final classes can’t be inherited that means it can not have child classes and final
method of a class cannot be redefined.

25. What is an interface?
Interfaces contain only public methods with no implementation; these interfaces
are included in public section of classes and implement the methods of interfaces.

26. Can we implement interface in private section of any class?
No

26. What is alias?

Instead of specifying full name of interface methods, we can assign it a name
which can directly trigger.

28. What is a friend class?
Friend class is a class it can access private components of it’s friends class.

29. 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.

30. What is a Singleton class?

Singleton classes can be instantiated only once, i.e. only one object is created for
Singleton classes.

31. What is a Persistent class?

A special class, the attributes of which are linked to database tables via objectrelational
mapping. Since Release 6.10 they can be created using the Mapping Assistant of the Class Builder.
The objects of persistent classes are managed by Object Services. An object in a
persistent class, the attributes of which are saved as database content after the

run time of an ABAP program.

1 comment:

Unknown said...

CALFRE handles oracle fusion financials online training and its modules maintaining classroom based training with the self-paced videos. An expert having ten plus years of self-experience handles the training period through online and explains each and every point perfectly. We recently launched our institute in the USA and getting
the best reputation over there.



Oracle fusion Financials Training in hyderabad

Oracle Fusion Financials online Training in hyderabad

How to change Transport request from Released to Modifiable

Step 1: Go to SE38 – Execute Program RDDIT076.  Step 2: Give your released requests number and execute again. Step 3: After executing, yo...