You are on page 1of 7

1. Priniples of oops?

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

2. What is difference between procedural & OO Programming?

ability to simulate real-world event much more effectively


code is reusable thus less code may have to be written
data becomes active
better able to create GUI (graphical user interface) applications
programmers are able to reach their goals faster
Programmers are able to produce faster, more accurate and better-written
applications (in the case of a veteran programmer, by a factor of as much as 20
times compared with a procedural program).

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

5. Can we instantiate a class within implementation of other class?

yes

6. What is deferred key word ?

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.

7. How we can refer to a class without defining it?

using DEFFERED

8. Can we put non declarative statement e.g. START-OF-SELECTION within a class

yes

9. What is static attribute & method?

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.

10. How to create a global class ?

In SE24

11. How can we pass importing parameter ?

pass by value/pass by reference

13. Can we changed pass by reference in any method ?

Yes

14. What is preferred parameter ?

more than one optional & no mandatory

15. can we pass returing parameter by reference ?

NO only pass by value

16. can static method use instance attribute ?

no

17. Can a method call itself?

yes
18. What is me variable?

to refer to same class

19. What is constructor ?What are type of constructor ?When it is called ?

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:

Creating an instance using CREATE_OBJECT


Adressing a static attribute using <classname>-><attrbute>
Calling a ststic attribute using CALL METHOD
Registering a static event handler
Registering an evetm handler method for a static event
The static constructor cannot be called explicitly.

20. Can we have export parameter in Instance constructor?

no

21. Can instance constructor raise exception ?

yes

22. When static constructor is called?

when class is first accessed

23. Can we have interface for static class or constructor?

no

24. What is abstract class ?

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?

An abstract method is defined in an abstract class and cannot be implemented in


that class. Instead, it is implemented in a subclass of the class. Abstract classes
cannot be instantiated.

26. What is final class & Method ?

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.

27. Can subclass call super class constructor?

no

28. Can we call static constructor more than once in a program?

no

29. What is method redefinition?

Overriding is useful, when we want to extend the functionality of the inherited


method

30. What is interface ?

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.

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

no

32. Is it mandatory to implement all the methods of interface ?

no

33. What is alias ?

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

34. What is Friendship?

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.

35. What is event handler method ?

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

37. Can event have import parameter ?

no

38. How you handled exception during programming?

sy-subrc or try...endtry

39. What is cleanup section ?

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.

40. What is BADI?

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.

41. What is check box for multiple use in BADI?

multiple implimentation can exitst.

42. How to search a BADI ?

� Finding BADI Using CL_EXITHANDLER=>GET_INSTANCE


� Finding BADI Using SQL Trace (TCODE-ST05).
� Finding BADI Using Repository Information System (TCODE- SE84).

43. What is Value table and Check table, Difference between them?

Value Table

This is maintained at Domain Level.


When ever you create a domain , you can entered allowed values.
When ever you use this Domain, the system will forces you to enter only these
values.
This is a sort of master check . To be maintained as a customization object. This
mean that if you want to enter values to this table you have to create a
development request & transport the same.

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.

44. What are secondary index's?


user created index for fast finding

45. What is the draw back of secondary index's?

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.

46. What are conversion routines?

A conversion routine CONV (also known as conversion exit) is represented by two


function modules that adhere to the naming convention CONVERSION_EXIT_CONV_INPUT|
OUTPUT. In these function modules, no statements can be executed that interrupt the
program flow or end a SAP LUW. A conversion routine can be assigned to a domain in
the ABAP Dictionary.

47. At which level are they mantained?

domain

61. What is a delivery class?

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.

62. What are the types of delivery class?

There are the following development classes:


A: Application table (master and transaction data).
C: Customer table, data is only maintained by the customer.
L: Table for storing temporary data.
G: Customer table, SAP may insert new data records but may not overwrite or delete
existing ones. The customer namespace must be defined in table TRESC. To define the
customer namespace use report RDDKOR54. You can start it directly from the table
maintenance by choosing Customer namespace definition on the Attributes tab.
E: System table with its own namespace for customer entries. The customer namespace
must be defined in table TRESC. To define the customer namespace use report
RDDKOR54. You can start it directly from the table maintenance by choosing Customer
namespace definition on the Attributes tab.
S: System table, data changes have the status of program changes.
W: System table (e.g. table of the development environment) whose data is
transported with its own transport objects (e.g. R3TR PROG, R3TR TABL, etc.).

66. What is persistant class

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.

You might also like