SAP OOPS ABAP Interview Questions

ABAP OOPS Interview Questions

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.

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 an actual instance of a Class.

How can polymorphism be implemented?

Implement polymorphism:

Method Overriding

Method Overloading

Operator Overloading

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.

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 superclass. This means that when overriding a method the subclass method has to have the same name and parameter list as the super class’s overridden method.

What is Method Overloading ?

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

What is Aggregation ?

Aggregation is a special form of association. Aggregation is the composition of an object out of a set of parts. For example, a car is an aggregation of engine, tyres, brakes, etc.

Aggregation represents a “Has” relationship like a car has a engine.

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.

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. In object-oriented programming, polymorphism (from the Greek meaning “having multiple forms”) is the characteristic of being able to assign a different meaning to a particular symbol or “operator” in different contexts. The simple example is two classes that inherit from a common parent and implement the same virtual method.

Encapsulation:

Encapsulation: Encapsulation is the ability that an object has to contain and restrict the access to its members. Encapsulation is a key concept of object programming that ensures the autonomy and integrity of the objects. Abstraction: Another OOPS concept related to encapsulation that is less widely used but gaining ground is abstraction.

Abstraction:

Through the process of abstraction, a programmer hides all but the relevant data about an object in order to reduce complexity and increase efficiency. In the same way that abstraction sometimes works in art, the object that remains is a representation of the original, with unwanted detail omitted. The resulting object itself can be referred to as an abstraction, meaning a named entity made up of selected attributes and behavior specific to a particular usage of the originating entity.

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.

What are the types of Objects and Classes ?

There are two types of Objects: Instance Object and Static Object

Two types of Classes:

Instance class

Static Class.

What are the types of classes which can be created ?

We can create four types of classes under final and only modeled category(optional) with the private, protected, public and abstract instantiation.

Usual Abap Class.

Exception Class(With/Without messages).

Persistent Class.

Test Class(ABAP Unit).

What are the types of classes which can be created ?

We can create four types of classes under final and only modeled category(optional) with the private, protected, public and abstract instantiation.

Usual Abap Class.

Exception Class(With/Without messages).

Persistent Class.

Test Class(ABAP Unit).

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.

What is an Object?

Object is an instance of a class. It has state, behavior and identity. It is also called as an instance of a class.

What is meant by Binding?

Binding denotes association of a name with a class.

What is meant by static binding?

Static binding is a binding in which the class association is made during compile time. This is also called as Early binding.

What is meant by Dynamic binding?

Dynamic binding is a binding in which the class association is not made until the object is created at execution time. It is also called as Late binding.

OO ABAP Interview Questions

Define Modularity?

Modularity is the property of a system that has been decomposed into a set of cohesive and loosely coupled modules.

What is meant by Persistence?

Persistence is the property of an object by which its existence transcends space and time.

What is collaboration?

Collaboration is a process whereby several objects cooperate to provide some higher level behavior.

What is a singleton ?

If it is to be impossible to instantiate a class more than once (for example, because it serves as a data administrator or data container), you can use the singleton concept. The class is defined with the addition CREATE PRIVATE and FINAL and instantiated using its static constructor. A public static component could then make the reference to the class available to an external user.

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.

What are static components? What is a component selector ?

In inheritance, static components are “shared”: A class shares its non-private static attributes with all its subclasses. => and -> are the component selectors used to refer.

What are component instance ?

A component instance is a running component that can be run in parallel with other instances of the same component.

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.

What are BADIs? What are BADI filters ?

BADI – Business Add Ins are enhancements to the standard version of the code of SAP.

Filter Badi- Business Add-Ins may be implemented on the basis of a filter value. If an enhancement for country-specific versions is provided for in the standard version, it is likely that different partners will want to implement this enhancement. The individual countries can create and activate their own implementation.

What is a functional Method ?

Methods that have a RETURNING parameter are described as functional methods. These methods cannot have EXPORTING or CHANGING parameters, but has many (or as few) IMPORTING parameters and exceptions as required.

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.

In Java, How to make an object completely encapsulated?

All the instance variables should be declared as private and public getter and setter methods should be provided for accessing the instance variables.

How is polymorphism acheived in java?

Inheritance, Overloading and Overriding are used to achieve Polymorphism in java.

What are the advantages of OOPs?

The major advantages of OOPs are:

Feature

Description

Simplicity

Software objects model real-world objects, so the complexity is reduced and the program structure is very clear.

Modularity

Each object forms a separate entity whose internal workings are decoupled from other parts of the system.

Modifiability

It is easy to make minor changes in the data representation or the procedures in an OO program. Changes inside a class do not affect any other part of a program since the only public interface that the external world has to a class is through the use of methods.

Extensibility

Adding new features or responding to changing operating environments can be solved by introducing a few new objects and modifying some existing ones.

Maintainability

Objects can be maintained separately, making locating and fixing problems easier.

Re-usability

Objects can be reused in different programs

What are the main concepts of OOPs?

Following are the main concepts of OOPs?

Abstraction

Encapsulation

Inheritance

Polymorphism

What is Aggregation?

Aggregation is a special form of association. Aggregation is the composition of an object out of a set of parts. For example, a car is an aggregation of engine, tyres, brakes, etc.

Aggregation represents a “Has” relationship like a car has a engine.

What is Association?

Association defines a relationship between different objects of different classes which allows one object instance to cause another to perform an action on its behalf.

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.

What is message passing in object oriented programming?

Message passing is a method by which an object sends data to another object or requests other object to invoke method. This is also known as interfacing. It acts like a messenger from one object to other object to convey specific instructions.

What is Method Overloading?

Method overloading is the ability to define several methods all with the same name.

What is Operator Overloading?

The operator overloading is a specific case of polymorphisms in which some or all of operators like +, -, %, etc. are treated as polymorphic functions and as such have different behaviors depending on the types of its operands.

What do you mean by Object Slicing?

When a derived class object is assigned to a base class, only the base class’s part of content in the derived object are copied to the base class, leaving behind the derived class specific contents. This is referred as Object Slicing.

Give some examples of programming languages which support object oriented characteristics?

Some of the programming languages which support object oriented characteristics are ABAP, C++, Perl, LISP, Java, C#, Tcl, VB.Net, Ruby, Python, PHP, etc. Popularity of these languages has increased considerably as they can solve complex problems with ease.

What is a constructor?

Constructor is an operation that creates an object and/or initializes its state.

What is a destructor?

Destructor is an operation that frees the state of an object and/or destroys the object itself. In Java, there is no concept of destructors. Its taken care by the JVM.

What is a base class?

Base class is the most generalized class in a class structure. Most applications have such root classes. In Java, Object is the base class for all classes.

What is a subclass?

Subclass is a class that inherits from one or more classes

What is a superclass?

Superclass is a class from which another class inherits.

What is an ABAP data dictionary?

ABAP 4 data dictionary describes the logical structures of the objects used in application development and shows how they are mapped to the underlying relational database in tables/views.

What are the events in ABAP/4 language?

Initialization, At selection-screen,Start-of-selection, end-of-selection, top-of-page, end-of-page, At line-selection,At user-command, At PF, Get, At New, At LAST, AT END, AT FIRST.

How to Create an Object for Private Class?

Creating an object for the private class is not possible, but can access private class’s static method. We can call the method using its class name and import that object.

For instance, take one static method having an exporting parameter inside private class and write object creation code in that static method and then export that object.

Mention the major differences between the Static Class and Singleton in Sap ABAP?

Understanding static components are essential before going to static classes in Sap ABAP

Static Components: Static Components such as static attributes, static methods, and static events exists globally, it’s not necessary to create an instance/object of the class to access them, simply we can access them using static component selector =>.

Singleton Class: The class that does not allow creating multiple instances to access any object.

Static Class: The class that contains only static components without instance components is referred to a static class.

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”