Professional Documents
Culture Documents
Encapsulation
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.
Polymorphism
Polymorphism (ability to have multiple forms) in the context of object technology
signifies that objects in different classes have different reactions to the same
message.
Inheritance
Inheritance defines the implementation relationship between classes, in which one
class (the subclass) shares the structure and the behavior defined in one or more
other classes (superclasses).
3. What is 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 object?
Objects are instances of classes. Each object has a unique identity and its own
attributes. All transient objects reside in the context of an internal session
(memory area of an ABAP program). Persistent objects in the database are not yet
available. A class can have any number of objects (instances).
yes
The variant with the DEFERRED addition makes a class known provisionally in the
program.
Without the PUBLIC addition, this variant makes a local class known before its
actual definition. The program must contain an actual declaration part for class at
a later point in the program. You cannot access individual components of the class
before it is actually defined. You need to use this statement if you want to make a
reference to a local class before it is defined.
With the PUBLIC addition, this variant makes a global class known and defers
loading the class until the end of the current program unit. You can only access
individual components of the class after it has been loaded. This statement can be
used to prevent unwanted recursion when making references to global classes.
using DEFFERED
yes
Static Methods
You declare static methods using the CLASS-METHODSstatement. They can only access
static attributes and trigger static events.
Static Attributes
The contents of static attributes define the state of the class that is valid for
all instances of the class. Static attributes exist once for each class. You
declare them using the CLASS-DATA statement. They are accessible for the entire
runtime of the class.
All of the objects in a class can access its static attributes. If you change a
static attribute in an object, the change is visible in all other objects in the
class.
The technical properties of instance attributes belong to the static properties of
a class. It is therefore possible to refer in a LIKE addition to the visible
attributes of a class � through the class component selector or through reference
variables, without prior creation of an object.
In SE24
Yes
no
yes
18. What is me variable?
Constructor method
Implicitly, each class has an instance constructor method with the reserved name
constructor and a static constructor method with the reserved name
class_constructor.
The instance constructor is executed each time you create an object (instance) with
the CREATE OBJECT statement, while the class constructor is executed exactly once
before you first access a class.
The constructors are always present. However, to implement a constructor you must
declare it explicitly with the METHODS or CLASS-METHODS statements. An instance
constructor can have IMPORTING parameters and exceptions. You must pass all non-
optional parameters when creating an object. Static constructors have no
parameters.
Static constructor
The static constructor is always called CLASS_CONSTRUCTER, and is called
autmatically before the clas is first accessed, that is before any of the following
actions are executed:
no
yes
no
A class that is defined as ABSTRACT cannot be instantiated. This means that you
cannot use CREATE OBJECT with reference to the class. If a class contains any
abstract method then the whole class becomes abstract. A method, which is abstract,
should be redefined in derived class. An Abstract class can declare and implement
non abstract methods which its subclasses can use with or without redefining them.
25. Can we implement abstract method in abstract class ? if not then where it can
be implemented?
A class that is defined as final class can not be inherited further. All Methods of
a final class are inherently final and must not be declared as final in the class
definition. Also, a final method can not be redefined further.
no
no
Interfaces are independent structures that you can implement in a class to extend
the scope of that class. The class-specific scope of a class is defined by its
components and visibility sections. The public components of a class define its
public scope, since all of its attributes and method parameters can be addressed by
all users.
no
no
Instead of specifying full name of interface methods we can assign it a name which
can directly trigger.
A class can grant other classes and interfaces (and hence all classes that
implement this interface) its friendship. This is the purpose of the FRIENDS
additions to the CLASS ... DEFINITION statement, which lists all the classes and
interfaces that are granted friendship. These friends gain access to the protected
and private components of the class granting the friendship and can always create
instances of this class, independently of the CLASS statement's CREATE addition.
Each class can define methods that are intended specially for handling events. The
events to be handled can be triggered in the defining class or in external classes
and interfaces
36. Can we have more than one event handler method for same event ?
yes
no
sy-subrc or try...endtry
Precisely one CLEANUP block can be defined in each TRY-ENDTRY structure. If the
system has not found a handler for an exception, but the exception is handled in an
enclosing TRY-ENDTRY structure or is propagated to a caller, the block is executed
before the TRY-ENDTRY structure is exited.
Business Add-Ins are a new SAP enhancement technique based on ABAP Objects. They
can be inserted into the SAP System to accommodate user requirements too specific
to be included in the standard delivery. Since specific industries often require
special functions, SAP allows you to predefine these points in your software.
43. What is Value table and Check table, Difference between them?
Value Table
Check table
For example you have Employee master table & Employee Transaction table.
When ever an employee Transacts we need to check whether that employee exists , so
we can refer to the employee master table.
This is nothing but a Parent & Child relationship . Here data can be maintained at
client level , no development involved.
Additional indexes can place a load on the system since they must be adjusted each
time the table contents change. Each additional index therefore slows down the
insertion of records in the table.
domain
Delivery Class
The delivery class controls the transport of table data for installation, upgrade,
client copy and when transporting between customer systems. The delivery class is
also used in the extended table maintenance.
Persistent Classes
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.