Home ABAP Tutorials ABAP Objects Classes and Objects
Classes and Objects PDF Print E-mail
User Rating: / 8
PoorBest 
ABAP Tutorials - Object Oriented ABAP
Written by mastram   
Saturday, 07 June 2008 14:14

Classes and Objects are building blocks of any OOP language.

An entity from a real world is mapped as class in programming language. A class is an abstract representation of real object in real world. Technically, a class is a package that contains some data and defines some methods that can be performed on that data. A class has an interface and a structure (data) also. The interface describes how the object of a class interacts with the outer world, while the structure represents the data format.

Confused Surprised.. Okay lets understand by an example..

Consider a human being named 'Neo'. Neo has a pair of eyes, ears, hands, legs, nose, brain and many other parts. And what can Neo do ? He can Kick, Jump, Fly and do many other things. now if you had to map this into a computer program how would you do it ?

There could be many ways you can do it. But the best would be with OOP. So in this case we create a class called 'Human' whose attributes are eyes, ears, hands, legs etc. and methods are kick, fly, jump etc. Now lets say Neo is not alone, we have Morpheus also. So Morpheus becomes another instance of the same class 'Human' (because Morpheus also has eyes, ears etc and he can also kick, fly and jump). Thus I can have many more instances of Human as Trinity, Cypher etc.

From this example we explained:

  • A class is an abstract representation of a real object in real world
  • A class encapsulates data (hands, legs) and its methods (kick, fly) also.
  • A new object with same functions and features is just an different instance (Morpheus and Trinity) of the same class
Simple right Smile
In the next chapter we will learn how to create class and instantiate its object in ABAP.
Comments
Add New Search
pshrikant  - Classes and Objects   |address59.95.74.148 |2008-08-20 14:29:59
What ever I learn from above is so gental and easy to udstand.
I would like to
request u Pl explain about Domain? and Kernal?

Regards
SMYLAPUR   |address193.234.247.50 |2008-09-16 05:52:03
it is soo understadable. Thanks
SND  - Class & Objects   |address220.225.79.85 |2009-05-12 23:58:29
Very nice and simple explanation of critical sap langu.

thanks
kalpana  - oo example   |address124.30.170.4 |2009-07-01 05:54:47
please send me a basic code for displaying output of some sales data using OO
programing.
mastram  - Please try your self...   |Publisher |2009-07-05 00:26:48
Hello Kalpana,
I would suggest you to try yourself first and then if you face
some problems then ask solutions for those...
If you ask for sample code, then
you will never be able to learn..

Besides that, OO ABAP is not very different
from any other OO language or ABAP itself...
Write comment
Name:
Email:
 
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Thursday, 14 August 2008 02:12 )
 

Advertisement

 

Google Search

Advertisement