Live Object Oriented SAP ABAP Online | SAP Courses at Acutesoft
India:+91 (0)8885575549, 040-42627705 | USA: +1 973-619-0109 | UK: +44 207-993-2319 Santosh@acutesoft.com
Select Page

SAP OO ABAP ONLINE TRAINING

SAP OO ABAP ONLINE TRAINING IN INDIA, USA & UK

SAP OO ABAP ONLINE TRAINING IN CANADA

SAP OO ABAP ONLINE TRAINING IN AUSTRALIA

SAP OO ABAP ONLINE TRAINING

SAP OO ABAP COURSE CURRICULUM

Download [PDF]

  • Introduction to Object-Oriented Programming

      The Need for a Better Abstraction
      Classes and Objects
      Establishing Boundaries
      Reuse
      Object Management
      UML Tutorial: Class Diagram Basics
      Summary
  • Working with Objects
      Syntax Overview
      Creating and Using Objects
      Building Your First Object-Oriented Program
      Getting Started with the Class Builder
      Case Study: Working with Regular Expressions
      UML Tutorial: Object Diagrams
      Summary
  • Encapsulation and Implementation Hiding
      Lessons Learned from the Procedural Approach
      Data Abstraction with Classes
      Defining Component Visibilities
      Hiding the Implementation
      Designing by Contract
      UML Tutorial: Sequence Diagrams
      Summary
  • Object Initialization and Cleanup
      Creating Objects
      Controlling Object Initialization with Constructors
      Garbage Collection
      Tuning Performance
      Summary
  • Inheritance
      Generalization and Specialization
      Inheriting Components
      The Abstract and Final Keywords
      Inheritance
      Using the Refactoring Assistant
      UML Tutorial: Advanced Class Diagrams Part I
      Summary
  • Polymorphism
      Object Reference Assignments Revisited
      Dynamic Method Call Binding
      Interfaces
      UML Tutorial: Advanced Class Diagrams Part II
      Summary
  • Error Handling with Exceptions
      Lessons Learned from Prior Approaches
      The Class-Based Exception Handling Concept
      Dealing with Exceptions
      Raising and Forwarding Exceptions
      Creating Exception classes
      UML Tutorial: Activity Diagrams Summary
  • Working with the SAP List Viewer
      Overview of the SAP Control Framework
      Overview of the ALV Object Model
      Getting Started with the Flight Query Report
      Event Handling with the ALV Object Model
      UML Tutorial: Communication Diagrams
  • ABAP Object Services
      Object-Relational Mapping Concepts
      Persistence Service Overview
      Building Persistent Classes
      Working with Persistent Objects
      UML Tutorial: Advanced Sequence Diagrams
      Summary
  • Debugging Objects
      Debugging Objects Using the Classic ABAP Debugger
      Debugging Objects Using the New ABAP Debugger

ADVANCED CONCEPTS IN ABAP OBJECTS

  • Objects constitute the key concept in object-oriented programming.
  • An object is a self-contained unit whose status is determined by the values of its attributes, whose behavior is determined by its methods, and whose identity is defined by its address in the memory.
  • An object is accessed by reference variables, which refer to this address.
  • An object in a program that performs a certain task should reflect a real object of the task 1:1 as far as possible.
  • With objects, a clear distinction can be made between the public interface and the private and protected components, which are not externally visible.

One object can interact with another by accessing its attributes directly in a method, calling methods, or triggering an event3 Classes consist of source code containing the definition of possible objects. An object is always an instance of a class, which is addressed by at least one reference variable. All components and properties of its objects are declared in a class. Thebasis for encap-sulation in ABAP Objects is always the class, rather than the object.1 Classes are either global for all programs or local in a sin-gle program. They can be specialized by inheritance, and can incorporate standalone interfaces as a public inter-face.Attributes describe the status of an object. Technically speaking, attributes (instance attributes) are the local variables of an object, which cannot normally be changed directly from the outside. A class may also contain static attributes, which are jointly used by all objects of the class.Static attributes may be variables or con-stants.Methods allow objects to perform operations.

A method (instance method) always works in a specific object. In other words, it reads and changes the status of this object, and interacts with other objects by calling their methods or by triggering events. A method has a parameter interface, and can pass on exceptions. A class may also contain static meth-ods, which only accessstatic attributes,and can only trigger static events.

Method Interfaces and Method calls
Methods in their fundamental role as the operational components of classes. examines the parameter interface of methods in more detail, and focuses in particular on the various options with method calls.

Specialization by Inheritance

ABAP Objects supports simple inheritance, whereby a class can be declared as the direct subclass of exactly one superclass. All classes of ABAP Objects are part of an inheritance hierarchy tree originating in one common superclass. In addition to its own components, a subclass also contains the components of its superclass. The implementation of superclass methods can be overwritten in subclasses.

Standalone Interfaces

The public visibility section of a class is its external interface. ABAP Objects allows you to create standalone interfaces, which can be used by classes as part of their interface, or even as their complete interface. Objects belonging to various classes that use the same interface can be handled by outside users in the same way. An standalone interface may also comprise several other interfaces.

Object Reference Variables and Polymorphism

Objects in a program can only be accessed by object references in object reference variables. The type of the object reference variables determines exactly what a program can do with an object. There are both class reference variables and interface reference variables. The latter enable exclusive access to the interface components of a class. The concepts of inheritance and independent interfaces allow you to assign object references between reference variables of different types according to certain rules. This opens up the possibilities of polymorphism, whereby the same reference variable can be used to access objects belonging to different classes with different behavior.

Events and Event Handling

A method of an object is normally executed after a direct call. In this case, the calling object and the called object are closely coupled. Events are used to decouple the caller from the called method. In ABAP Objects, events, like attributes and methods, are component type of classes. An object can trigger an event in a method, and methods of other objects can handle this event. This corresponds to an indirect method call because the calling method does not need to know anything about the possible event handlers.

Shared Objects

Objects as instances of classes exist in the memory area of a pro-gram, and are deleted at the latest when the program is exited. As a result, cross-program access to objects is not generally possible. However, ABAP Objects enables cross-program access with shared objects, which are objects in the shared memory of an application server.

The basic concepts of ABAP Objects, which were introduced in (i. e., classes with attributes and methods, objects, and object references), are used in almost all object-oriented programming languages. The advanced concepts introduced in this chapter comprise, on the one hand, a selection of tried and tested advanced techniques adopted by ABAP Objects based on the standards of well-known object-oriented programming languages like Java or C++, and, on the other hand, specialized techniques that are unique to ABAP Objects. When this language was designed, special care was taken to ensure that the focus on business applications was not lostCertain concepts of object-oriented programming, such as multiple inheritances, which is used in C++, for example, would have served only to increase the complexity of the language, without offering any additional benefits for SAP applications. In accordance with the ASAP principle, of �As Simple As Possible,� ABAP Objects was made as easy to understand as possible, and only well-established object-oriented concepts were used. Following the example of Java, the interface concept was introduced in place of multiple inheritances. The correct application of inheritance and interfaces represents the crowning achievement of object-oriented programming, and pro-vides a range of options for managing complexity.The range of options for defining a parameter interface for methods is, in contrast, specific to ABAP. Similarly, the concept of fully integrating events into the language scope of ABAP Objects as independent components of classes is not a feature of all object-oriented programming languages.

Inheritance

In object orientation, inheritance refers to the specialization of classes by deriving subclasses from superclasses.

Basic Principles

Classes provide a construction plan for objects. Suppose you create two classes called �Car� and �Truck�. You want to implement methods for both classes, which control the objects or return information about their location and speed. Even at this stage, you can foresee that some parts of the classes will have to be written twice. The inheritance mechanism of an object-oriented programming language provides options that help you to reuse the same or similar parts of a class, and to create a hierarchy of classes.

Superclasses and subclasses

If we examine the two classes (i. e., �Car� and �Truck�) in more subclasses detail, it becomes clear that both classes comprise types of vehicles.If you want to create a third class called �Dump truck� it will comprise a specific type of truck. To create a hierarchy relationship between these classes, classes can be derived from each other using inheritance. In our example, �Car� and �Truck� are derived from the �Vehicle� class, while �Dump truck� are derived from the �Truck� class. Derived or more specific classes are referred to as subclasses, while more general classes are called superclasses.

Simple inheritance

The concept of simple inheritance is implemented in ABAP Objects. According to this concept, each class can have several subclasses but only one superclass.9 In simple inheritance, inheritance relationships are represented by an inheritance tree. Every class in an object-oriented programming language in which simple inheritance is implemented has a unique position as a node in an inheritance tree. This also applies to all the classes we have dealt with up to now, although we have not yet spoken of them in terms of inheritance. For each class, a unique path can be traced back through their superclasses in the inheritance tree until you reach exactly one root node. This root node is the superclass of all classes in the inheritance tree.

Root class

The root node of the inheritance tree in ABAP Objects is the predefined, empty, and abstract class object.

Inheritance simply means that a subclass inherits all components (attributes, methods, events, etc.) of its superclass and can use them like its own components. In each subclass, new elements can be added or methods can be redefined in order to specialize, without this having any impact on the superclass. Elements can only be added in subclasses. It would go against the inheritance concept to remove elements in a subclass.

Visibility Sections and Namespaces in Inheritance

There are three different visibility sections in a class, in which the components of the class are declared. A subclass inherits all components of its superclasses without changing their vis-ibility. For that reason, only the public and protected components of its superclasses are visible in a subclass. In contrast, the private com-ponents are contained in the subclass but are invisible. The visibility sections of a subclass therefore contain the following components:

PUBLIC

The public visibility section of a subclass contains all public com-ponents of all superclasses, plus its own additional public compo-nents. These components can be accessed externally using compo-nent selectors.

PROTECTED

The protected visibility section of a subclass contains all protected components of all superclasses, plus its own additional protected components. These components cannot be accessed externally using component selectors. From an external point of view, �pro-tected� is the same as �private.�

PRIVATE

The private visibility section of a subclass contains only the sub-class�s own private components. These components can only be accessed in the method implementations of the subclass.

Since all visible components in a class must have unique names, all Namespace public and protected components of all classes along an inheritance path in the inheritance tree belong to the same namespace and have unique names. Private components, which are only visible within a class and cannot be used in subclasses, must only have unique names within their own class.

The implications of this are as follows: A superclass is not aware of any subclasses it may have. If you create a non-final class in a class library and release it for use, you can never know, as a developer, which subclasses your class will eventually have other than those you define yourself. If you then subsequently add new components to the public or protected section of your class, and any of its sub-classes happen to have a component of its own with the same name,this becomes syntactically incorrect. Therefore, it is only secure to add private components. In global classes, not only the external interface but also the interface with any possible subclasses must remain stable.

Therefore, to limit the subclasses of a class to at least the same package, non-final classes should preferably be organized in packages for which the Package Check as Server property is activated

Method Redefinition

New implemen-tation Access

A subclass inherits all public and protected methods additionally to its own components. When a method is called in the subclass, it is executed in the same way it was implemented in the superclass, and even uses the private components of the superclass. However, since the main purpose of inheritance is to specialize classes, the behavior of the method of a superclass may be too general for the more spe-cific purpose of the subclass. In some cases, the implementation of superclass must be enhanced in the subclass, while in other instances, the implementation must be completely changed. How-ever, the semantics of the method must remain stable for the exter-nal user, because all this user ever sees is the constant interface (including the documentation) and not the implementation itself.

Instance methods can be redefined in subclasses to specialize the behavior of subclass objects. Static methods cannot be redefined. Redefining a method means creating a new implementation of the method in a subclass without changing the interface.12 The method is still declared in the superclass. Previous implementations of the method in preceding superclasses remain unchanged. When a method is redefined in a subclass, an additional implementation is created, which hides the previous implementation when the subclass and further subclasses are used.

Every reference that refers to an object of the subclass uses the rede-fined method. This is always the case, regardless of the type of the reference variables. This applies in particular to the self reference me. Therefore, if a superclass method (meth1) contains the call of a method (meth2) belonging to the same class, which is redefined in a subclass, the call of the meth1 method in an instance of the superclass results in the execution of the original method (meth2), while the call of the meth1 method in an instance of the subclass results in the execution of the redefined method.

DEMO VIDEOS

UPCOMING DEMOS

For updated Schedules please contact
calls

OO ABAP QUESTION AND ANSWERS

  • 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.
  • Objects
    An object is a section of source code that contains data and provides services. The data forms the attributes of the object. The services are known as methods (also known as operations or functions). Typically, methods operate on private data (the attributes, or state of the object), which is only visible to the methods of the object. Thus the attributes of an object cannot be changed directly by the user, but only by the methods of the object. This guarantees the internal consistency of the object.
    Classes
    Classes describe objects. From a technical point of view, objects are runtime instances of a class. In theory, you can create any number of objects based on a single class. Each instance (object) of a class has a unique identity and its own set of values for its attributes.
    Object References
    In a program, you identify and address objects using unique object references. Object references allow you to access the attributes and methods of an object.
    In object-oriented programming, objects usually have the following properties:
    Encapsulation
    Objects restrict the visibility of their resources (attributes and methods) to other users. Every object has an interface, which determines how other objects can interact with it. The implementation of the object is encapsulated, that is, invisible outside the object itself.
    Polymorphism
    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.
    Inheritance
    we can use an existing class to derive a new class. Derived classes inherit the data and methods of the superclass. However, they can overwrite existing methods, and also add new ones.
    Uses of Object Orientation
    Complex software systems become easier to understand, since object-oriented structuring provides a closer representation of reality than other programming techniques.
    In a well-designed object-oriented system, it should be possible to implement changes at class level, without having to make alterations at other points in the system. This reduces the overall amount of maintenance required.
    Through polymorphism and inheritance, object-oriented programming allows you to reuse individual components.
    In an object-oriented system, the amount of work involved in revising and maintaining the system is reduced, since many problems can be detected and corrected in the design phase.
  • 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.
  • How polymorphism can be implemented?
      Some examples to implement polymorphism:
      1) Method Overriding
      2) Method Overloading
      3) 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 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.
  • 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 advantages of ABAP OOPS?
      Through inheritance we can eliminate redundant code and extend the use of existing class.
      We can develop programs from the existing classes given by SAP.
      The concept of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of programs.
      OOP system can be easily upgraded from smaller system to larger system.
      Software complexity can be easily managed.
      Code reusability.
      For interfacing ABAP with Microsoft technologies, Java as all these are Build on the concept of OOP .
      To easily understand the recent concepts of ABAP ex BAPI, BADI workflow.
  • 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.
  • Definition: Polymorphism
      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.
  • Definition: 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 OOP concept related to encapsulation that is less widely used but gaining ground is abstraction.
  • Definition: 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?
      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.
  • 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 local and global classes?
      classes in ABAP Objects can be declared either globally or locally.
      You define global classes and interfaces in the Class Builder (Transaction SE24) in the ABAP Workbench.
      They are stored centrally in class pools in the class library in the R/3 Repository. All of the ABAP programs in an R/3 System can access the global classes.
      Local classes are defined within an ABAP program. Local classes and interfaces can only be used in the program in which they are defined.
      When you use a class in an ABAP program, the system first searches for a local class with the specified name. If it does not find one, it then looks for a global class
      Apart from the visibility question, there is no difference between using a global class and using a local class.
      If you are defining a local class that is only used in a single program, it is usually sufficient to define the outwardly visible components so that it fits into that program.
      Global classes, on the other hand, must be able to be used anywhere. This means that certain restrictions apply when you define the interface of a global class,
      Local classes consist of ABAP source code, enclosed in the ABAP statements CLASS … ENDCLASS. A complete class definition consists of a declaration part and, if required, an implementation part. The declaration part of a class is a statement block:
      CLASS DEFINITION.
      ENDCLASS.
      It contains the declaration for all components (attributes, methods, events) of the class. When you define local classes, the declaration part belongs to the global program data. You should therefore place it at the beginning of the program.
      If you declare methods in the declaration part of a class, you must also write an implementation part for it. This consists of a further statement block:
      CLASS IMPLEMENTATION.

      ENDCLASS.
      he implementation part of a class contains the implementation of all methods of the class. The implementation part of a local class is a processing block. Subsequent coding that is not itself part of a processing block is therefore not accessible.
  • 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 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 are Abstract classes and an Abstract Method?
      Abstract classes themselves cannot be instantiated (although their subclasses can) References to abstract classes can refer to instances of subclasses.
      Abstract (instance) methods are defined in the class, but not implemented. They must be redefined in subclasses.
      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 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).
  • 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.

    CLASS lcl_vehicle DEFINITION ABSTRACT. PUBLIC SECTION. METHODS estimate_fuel_consumption ABSTRACT IMPORTING … ENDCLASS.

      Final method
      Final classes cannot have subclasses.
      Final methods cannot be redefined in subclasses.
      A final class implicitly only contains final methods. In this case, you cannot enter FINAL explicitly for these methods. Methods cannot be both final and abstract. Classes, on the other hand, that are both abstract and final can be useful: Only static components can be used.
      Final methods cannot be redefined in subclasses

    CLASS lcl_bus DEFINITION INHERITING FROM lcl_vehicle. PUBLIC SECTION. METHODS estimate_number_of_free_seats FINAL. ENDCLASS.

  • What is a super class? How can it be implemented?
      A superclass is a generalization of its subclasses. The subclass in turn is a specialization of its superclasses.
  • CLASS lcl_vehicle DEFINITION. PUBLIC SECTION. METHODS estimate_fuel IMPORTING im_distance TYPE ty_distance RETURNING VALUE(re_fuel) TYPE ty_fuel. ENDCLASS. CLASS lcl_truck DEFINITION INHERITING FROM lcl_vehicle. PUBLIC SECTION. METHODS estimate_fuel REDEFINITION. … ENDCLASS. CLASS lcl_truck IMPLEMENTATION. METHOD estimate_fuel. … super->estimate_fuel(…) ENDMETHOD. ENDCLASS.

  • 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.
  • What is a Widening Cast?
      The widening cast is, as with inheritance, the opposite of the narrowing cast: Here it is used to retrieve a class reference from an interface reference.
  • 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.
  • DATA: r_single type ref to cl_singleton. START-OF-SELECTION. r_single = cl_singleton=>get_singleton( ).

  • What is a constructor?
      Special method for creating objects with defined initial state, Only has IMPORTING,
      parameters and EXCEPTIONS, Is executed only once per instance.
  • Example of Constructor CLASS my_class DEFINITION. PUBLIC SECTION. METHODS CONSTRUCTOR. – note constructor should be always declared in public. ENDCLASS. CLASS my_class IMPLEMENTATION. METHODS CONSTRUCTOR. write :/ “this is constructor method”. ENDMETHOD.

  • 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 interfaces? What are the advantages of interfaces?
      Interfaces are the means of choice for describing external points of contact or protocols, without linking them to a type of implementation. An extra layer is introduced between the client and the server to protect the client explicitly from the server, thereby making the client independent. Interfaces enable you to work uniformly with different classes (providers/servers). In particular, they always ensure polymorphic behavior as they do not have their own implementation, but instead allow the providers to carry it out. The definition of an interface is always an abstraction: The user wants to handle various providers in the same way and must therefore abstract concrete implementations to a description of the services required to fulfill the task. You can also use interfaces to achieve multiple inheritance by defining the functionality to be inherited by a second class as an interface that the inheriting class then has to implement.
  • 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.
  • How can an event be raised and handled?
      Events link objects or classes more loosely than direct method calls do. Method calls establish precisely when and in which statement sequence the method is called. However, with events, the reaction of the object to the event is triggered by the event itself. Events are most often used in GUI implementations. At the moment of implementation, a class defines its:
      Instance events (using the EVENTS statement)
      Static events (using the CLASS-EVENTS statement)
      Classes or their instances that receive a message when an event is triggered at runtime and want to react to this event define event handler methods.
      Statement:
      [CLASS-]METHODS FOR EVENT OF .
      These classes or their instances are registered to one or more events at runtime.
      Statement: SET HANDLER FOR . (for instance events)
      SET HANDLER . (for static events)
      A class or instance can trigger an event at runtime using the RAISE EVENT statement.
  • What are Exceptions? How can an Exception be raised?
      Exceptions that occur in procedures (methods, function modules, or subroutines) do not necessarily need to be handled there; they can be passed along to the calling program.
      The calling program can then handle the exception itself or also pass it along to its own caller, and so on.
      The highest levels to which an exception can be passed are processing blocks without local data areas – that is, event blocks or dialog modules.
      The exceptions passed along by the called procedures must be dealt with there, as must any exceptions raised within this processing block itself. Otherwise a runtime error occurs.
      To pass along an exception from a procedure, you generally use the RAISING addition when defining the procedure interface. In methods of local classes and subroutines, specify the RAISING addition directly when defining the procedure
      (METHODS meth … RAISING cx_… cx_…, FORM form … RAISING cx_… cx_…).
      After RAISING, list the exception classes whose objects are to passed along.
      In methods of global classes, the exception classes whose objects are to be propagated are entered in the exception table of the method in the Class Builder. Check the Exception Class field in this exception table.
      Similarly, exceptions raised by function modules are passed along by being entered in the Function Builder.
      the exception we have defined (zcx_wrong_planetype) is raised if the airplane type passed to the method get_technical_attributes is not stored in the table saplane.
      Here, however, the exception is only raised in the method get_technical_attributes, not handled there.
      To pass the exception along to the caller of the method, we enter it after the RAISING keyword.
      Now, the caller – that is, the method display_attributes – handles the exception. For this purpose, we have implemented a TRY-ENDTRY control structure in this method. The methodget_technical_attributes is now called in the TRY block of this control structure.
      If the exception is raised in the method get_technical_attributes, the program continues by handling this exception. That is, the method get_technical_attributes is terminated and the appropriate CATCH block is processed within the caller. Note in particular that the program no longer executes the WRITE statements entered in the TRY block after get_technical_attributes is called.
  • What are the types of Exception classes?
      a. Global
      b. Local Exceptions Class.
  • Where can a protected method be accessed?
      Protected components Only visible within the class and its sub classes.
  • What is a signature of a method?
      Methods have a parameter interface (called signature ) that enables them to receive values when they are called and pass values back to the calling program.
      In ABAP Objects, methods can have IMPORTING, EXPORTING, CHANGING, and RETURNING parameters as well as exception parameters.
      CLASS DEFINITION. … METHODS: [ IMPORTING TYPE EXPORTING TYPE CHANGING TYPE RETURNING VALUE() TYPE EXCEPTIONS RAISING ]. ENDCLASS.(signature of a method). CLASS IMPLEMENTATION. METHOD . … ENDMETHOD. ENDCLASS.
  • What is an alias in ABAP OOPS?
      Within a class, attribute names, method names, event names, constant names, type names and alias names all share the same namespace. In ABAP Objects, the same components can be defined in interfaces and in classes. This allows you to shift part of the public point of contact of a class into an interface, even though the class is already in use; users will not notice the difference as long as you use alias names (see appendix) for the components that are now in the interface. To simplify accessing interface methods you can work with alias names.
      1. Alias names can only appear in the in the declaration part of a class or in the interface definition.
      Example for an alias in the interface: ALIASES a1 FOR lif_interface~method1
      2. An alias defined in this way can be directly addressed using r_ref->a1.
  • What is a Persistent Class? Explain.
      To use the Persistence Service for objects, the classes of these objects must be created as persistent classes in the Class Builder. The term persistent class does not imply that a class is persistent. (As a template for objects, every class is persistent). Rather, it means that the objects of that class and their state are managed by the Persistence Service. For example, the objects of these classes are instantiated in the ABAP program with a method of the Persistence Service, which ensures that the initialization is correct (not with the usual CREATE OBJECT statement). When the Class Builder creates a persistent class, it automatically generates an associated class, known as the class actor or class agent, whose methods manage the objects of persistent classes. As well as their identity, persistent classes can contain key attributes, which allow the Persistence Service to ensure that the content of each persistent object is unique.
  • 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.
  • What is a Framework?
      Automation Controller
      The automation controller is the central instance at the frontend. It administers all instances of custom controls.
      The Automation Controller also contains a list of the events that a custom control can trigger. All communication between the controls at the frontend and the application program at the backend runs through the Automation Controller.
      ABAP Objects Control Framework
      ABAP Objects Control Framework has a similar function at the backend to that of the Automation Controller at the frontend. All method calls from an application program to a custom control run through the Control Framework. In order to avoid each method call establishing a separate connection to the frontend, the method calls are buffered in the automation queue. The automation queue is not sent to the frontend until you reach a synchronization point. Like the Automation Controller, the Control Framework has a list of control events. This list also contains the corresponding handler methods that need to be called when the event occurs. The Control Framework also maintains a list of the control instances you have created. This list is the basis for the lifetime management of controls.
  • What is a Static Constructor? What are the advantages?
      The static constructor is a special static method in a class with the name class_constructor.
      It is executed precisely once per program.
      The static constructor of a class is called automatically when the class is first accessed, but before any of the following actions are executed:
      Creating an instance in the class using CREATE OBJECT , where has the data type REF TO
      Addressing a static attribute using =>
      Calling a static attribute using CALL METHOD =>
      Registering a static event handler method using SET HANDLER
      => FOR
      Registering an event handler method for a static event in class .
      The static constructor cannot be called explicitly.
      Advantages:
      For static constructors, unlike instance constructors, the static constructor in the superclass is called automatically, that is the runtime system automatically ensures that the static constructors of all its superclasses have already been executed before the static constructor in a particular class is executed.
      For static constructors, unlike instance constructors, the static constructor in the superclass is called automatically, that is the runtime system automatically ensures that the static constructors of all its superclasses have already been executed before the static constructor in a particular class is executed.
      the static constructor of the class creates exactly one instance of this class, which points to the attribute . This object is part of the persistence service and its methods are used to manage the object of the persistent class.
  • What is Private Constructor? Limitations?
      Private constructors are used to restrict the instantiation of object using ‘new’ operator. This type of constructors are mainly used for creating singleton object.
      Limitations:
      A private constructor is a special instance constructor. It is commonly used in classes that contain static members only.
      If a class has one or more private constructors and no public constructors, then other classes (except nested classes) are not allowed to create instances of this class.
      An instance constructor will always run after a static constructor.
      Private constructors prevent a class from being explicitly instantiated by callers.
  • Can a class be defined without a constructor?
      Yes, class can be created without any constructor. Default constructor will be created when we define a class without constructor.
  • What is a Friend class?
      A class can provide friendship to other classes and interfaces (and hence all classes that Implement the interface).
      To do this you use the FRIENDS additions to the CLASS statement, in which all classes and interfaces that are to be provided friendship are listed.
      Friends are allowed to access the protected and private components of the class providing the friendship and can always create instances of this class, regardless of the CREATE addition to the CLASS statement.
      In principle, providing friendship is one-sided: A class providing friendship is not automatically a friend of its friends. If a class providing friendship wants to access the non-public components of a friend, this friend has to explicitly provide friendship to it.
      Classes that inherit from friends and interfaces that contain a friend as a component interface also become friends. Therefore, extreme caution is advised when providing friendship. The higher up a friend is in the inheritance tree, the more subclasses can access all components of a class providing friendship. However, providing friendship, unlike the attribute of being a friend, is not inherited.
      A friend of a superclass is therefore not automatically a friend of its sub classes.
  • What is MVC?
      Model View Controller, is widely used in the user interface programming field and which has proved its worth, as an extension of the previous BSP implementation model. Its controller-based use ensures an even clearer distinction between application logic and presentation logic in BSP applications. You can structure graphical user interfaces clearly and organize them in logical units, even with complex applications.
      Using the MVC design pattern has the following advantages:
      Structuring BSP applications is simplified, since the view is cleanly separated from the controller and the model. This not only facilitates changing BSP applications, but also considerably improves their maintenance.