What Is Object Orientation?: Object Oriented Approach - Key Features
What Is Object Orientation?: Object Oriented Approach - Key Features
In the past, information systems used to be defined primarily by their functionality: Data and functions
were kept separate and linked together by means of input and output relations.
The object-oriented approach, however, focuses on objects that represent abstract or concrete things of
the real world. These objects are first defined by their character and their properties, which are
represented by their internal structure and their attributes (data). The behavior of these objects is
described by methods (functionality).
Comparison between Procedural and Object Oriented Programming
Features
Emphasis
Emphasis on tasks.
Modularization
Data security
Extensibility
2.
3.
4.
5.
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). They form a capsule
which combines the character to the respective behavior. Objects should enable programmers to map a real
problem and its proposed software solution on a one-to-one basis.
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.
Local and Global Classes
As mentioned earlier a class is an abstract description of an object. Classes in ABAP Objects can be declared
either globally or locally.
Global Class
Global classes and interfaces are defined 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 Class
Local classes are define in an ABAP program (Transaction SE38) and can only be used in the program in
which they are defined.
Global Class
Local Class
Accessed By
Any program
Stored In
Created By
Namespace
Local Classes
Every class will have two sections.
(1) Definition.
(2) Implementation.
Definition
This section is used to declare the components of the classes such as attributes, methods, events .They
are enclosed in the ABAP statements CLASS ... ENDCLASS.
CLASS <class> DEFINITION.
....
....
ENDCLASS.
Implementation
This section of a class contains the implementation of all methods of the class. The implementation part
of a local class is a processing block.
2.
3.
Attributes: Any data, constants, types declared within a class form the attribute of the class.
Methods: Block of code, providing some functionality offered by the class. Can be compared to
function modules. They can access all of the attributes of a class.
Methods are defined in the definition part of a class and implement it in the implementation part
using the following processing block:
METHOD <meth>.
...
ENDMETHOD.
Events:
class.
Interfaces: Interfaces are independent structures that you can implement in a class to extend
the scope of that class.
A mechanism set within a class which can help a class to trigger methods of other
Instance components exist separately in each instance (object) of the class and are referred
using instance component selector using .
Static components only exist once per class and are valid for all instances of the class. They are
declared with the CLASS- keywords.
Static components can be used without even creating an instance of the class and are referred to
using static component selector =>.
2. Visibility of Components
Data declared in public section can be accessed by the class itself, by its subclasses as well as
by other users outside the class.
Data declared in the protected section can be accessed by the class itself, and also by its
subclasses but not by external users outside the class.
Data declared in the private section can be accessed by the class only, but not by its subclasses
and by external users outside the class.
CLASS <class> DEFINITION.
PUBLIC SECTION.
...
PROTECTED SECTION.
...
PRIVATE SECTION.
...
ENDCLASS.
Inheritance.
Abstraction.
Encapsulation.
Polymorphism
Inheritance
Inheritance is the concept of adopting the features from the parent and reusing them. It involves passing the
behavior of a class to another class. You can use an existing class to derive a new class. Derived classes
inherit the data and methods of the super class. However, they can overwrite existing methods, and also add
new ones.
Inheritance is of two types:
1) Single Inheritance
2) Multiple Inheritance
Single Inheritance
Single Inheriting: Acquiring the properties from a single parent. (Children can be more).
Let us see a very simple example for creating subclass(child) from a superclass(parent)
Reference:
http://www.saptechnical.com/Tutorials/OOPS/Concepts/page1.htm
http://wiki.sdn.sap.com/wiki/display/ABAP/Object+Oriented
http://wiki.sdn.sap.com/wiki/display/ABAP/Object+Oriented+ABAP+%28OO-ABAP%29
http://wiki.sdn.sap.com/wiki/display/ABAP/Polymorphism+using+OO+ABAP
http://forums.sdn.sap.com/thread.jspa?threadID=728250
http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
http://help.sap.com/saphelp_46c/helpdata/EN/87/56d00722c011d2954a0000e8353423/content.ht
m#U--------------------------------------------SAP COMMANDS
Questions on OO ABAP
1. Principles of oops?
2. What is difference between procedural & OO Programming?
3. What is class?
4.
5.
6.
7.
8.
9.
What is object?
Can we instantiate a class within implementation of other class?
What is deferred key word?
How we can refer to a class without defining it?
Can we put non declarative statement e.g. START-OF-SELECTION within a class
What is static attribute & method?
43. What is Value table and Check table, Difference between them?
44. What are secondary indexs?
45. What is the draw back of secondary indexs?
46. What are conversion routines?
47. At which level are they mantained?
48. what are Predeifined data types?
49. Which predefined data type uses conversion routines?
50. What are logical units of work?
51. When is difference btw native and open sql
52. Difference between Modify and Update
53. Which is more efficient for all entries or joins?
54. When is implicit commit triggered.
55. What are RFC?
56. How do u create a destination system?
57. What are different types of commits used?
58. What are search helps?
59. Types of tables?
60. Difference between pool tables and cluster tables?
61. What is a delivery class?
62. What are the types of delivery class?
63. Difference between System tables and control tables?
64. What is normalization?
65. What is BCNF?
66. What is persistant class?
http://wiki.sdn.sap.com/wiki/display/Snippets/Binding+in+ABAP+OOP
http://www.saptechnical.com/Tutorials/OOPS/Binding/Procedure.htm
http://www.scribd.com/doc/35821441/Ooabap-Examples-------------***************
2.
3.
We can call next time the same attribute by using object then the same memory space is referred.
4.
Instance attributes:
1.
2.
That means for each and every call statement, the attribute creates a new memory location at every
time.