Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
20Activity
0 of .
Results for:
No results containing your search query
P. 1
Object Oriented ABAP Guide

Object Oriented ABAP Guide

Ratings: (0)|Views: 12,084|Likes:
Published by navabhatt

More info:

Categories:Types, Research, Science
Published by: navabhatt on Feb 01, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

11/09/2013

pdf

text

original

 
Page 1 of 40
Object Oriented ABAP ProgrammingNareshkumar PatelSAP-CRMWipro TechnologiesSUMMARY
 This is a step-by-step guide to learn ABAP Objects. Typically used to enableABAP developers to place their first step into ABAP Objects. This guide includesexamples with ready to use source codes (with output) to explain every topic.
PREREQUISITES
 This guide assumes that the reader has a good knowledge of ABAPWorkbench Fundamentals and has hands on experience of creating Report Programsas well as Module Pool Programs.
AUTHOR
 
Nareshkumar PatelSAP CRM Technical ConsultantWipro TechnologiesCONTENTS
 
 
Basic Terminology
 
Classes
 
Objects / Instances
 
Attributes
 
Methods
 
Constructor
 
Object Identity and Reference Semantics
 
Visibility
 
Events
 
Inheritance
 
Polymorphism
 
Interfaces
 
ALV Grid Control
 
ALV Grid Control Using Events
 
ALV Grid Control Using Field Catalogs
BASIC TERMINOLOGY
 For a long time it was standard practice in software development to subdividesoftware systems according to the system's functions. Object-orientation takesanother approach. Instead of concentrating on functions, the object-orientedapproach concentrates on data abstractions using - so-called Classes.
 
Page 2 of 40
CLASSES
 Classes are the central element of object-orientation. A Class describes ageneral element or a general concept. Classes realize an abstract data type. Classescontain components like: Attributes, Methods and Events. These components aredescribed later in this document. In ABAP Objects classes are made up of a definitionand an implementation part.CLASS CL_CLASSNAME DEFINITION.ENDCLASS.CLASS CL_CLASSNAME IMPLEMENTATION.ENDCLASS.
OBJECTS / INSTANCES
 An object is nothing more than an instance of a Class.Object - A person, place, thing, concept, or event that is applicable to thesystem at hand. Objects both know things (i.e., they have data) and they do things(i.e. they have functionality).In ABAP Objects, objects are created with the command CREATE OBJECT. Thedeveloper receives an object reference as a result of its creation:DATA: instance TYPE REF TO CL_CLASSNAME.START-OF-SELECTION.CREATE OBJECT instance.
ATTRIBUTES
 Attributes can take on values within an object at runtime. The sum of allattributes and their values describes the state of an object.Attributes can be defined as instance dependent as well as Class dependent.Class attributes (Class attributes are also called static attributes.) are not tied to asingle instance, rather they "belong" to all instances of the Class. These attributesexist only once in main memory. Instance-dependent attributes exist once perinstance and are tied to a single instance.In ABAP Objects you differentiate between instance-dependent and class-dependent attributes by means of the ABAP keywords DATA or CLASS-DATA to beused in the definition part:
 
Page 3 of 40
Report : 001
 
Code listing for: Z_001_SIMPLE_CLASS
 
Description: SIMPLE CLASS WITH ATTRIBUTES
 REPORT Z_001_SIMPLE_CLASS.TYPES: TY_NAME(50) TYPE C.*---------------------------------------------------------------- * CLASS CL_NAME DEFINITION *---------------------------------------------------------------- CLASS CL_NAME DEFINITION.PUBLIC SECTION.CLASS-DATA I_COUNT TYPE I." Class Dependent Attribute " Will have same value in all objects DATA NAME TYPE TY_NAME." Instance Dependent Attribute " Will have different values in different objects ENDCLASS."CL_NAME DEFINITION *---------------------------------------------------------------- * CLASS CL_NAME IMPLEMENTATION *---------------------------------------------------------------- CLASS CL_NAME IMPLEMENTATION." We will use this portion in next examples. ENDCLASS."CL_NAME IMPLEMENTATION " CREATE REFERENCE VARIABLES DATA: INSTANCE1 TYPE REF TO CL_NAME,INSTANCE2 TYPE REF TO CL_NAME,INSTANCE3 TYPE REF TO CL_NAME.START-OF-SELECTION." CREATE OBJECTS (INSTANCES) CREATE OBJECT: INSTANCE1,INSTANCE2,INSTANCE3.

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->