0% found this document useful (0 votes)
35 views23 pages

Oo Abap

The document provides an overview of Object-Oriented ABAP programming, covering key concepts such as classes, objects, methods, encapsulation, inheritance, polymorphism, and interfaces. It outlines the steps for creating local and global classes, as well as working with methods and events. Additionally, it includes practical examples and business scenarios related to displaying customer master data.

Uploaded by

snehalchavan899
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views23 pages

Oo Abap

The document provides an overview of Object-Oriented ABAP programming, covering key concepts such as classes, objects, methods, encapsulation, inheritance, polymorphism, and interfaces. It outlines the steps for creating local and global classes, as well as working with methods and events. Additionally, it includes practical examples and business scenarios related to displaying customer master data.

Uploaded by

snehalchavan899
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

object

MODULE POOL PROGoriented programming

SR KRISHNA

BY SR KRISHNA
MAIL ID: [email protected]
Contents

1 OOABAP Overview 6 Inheritance

2 Creating Class & Objects 7 Working with Interfaces

3 Working with Methods 8 Polymorphism

4 Working with Events


9 Business Scenarios

5 Encapsulation & Abstraction


1. OOABAP Overview

 Object Oriented Programming Languages:


ABAP
C++,
JAVA,
.NET,
ABAP etc…
Classic ABAP OO ABAP

Smart Forms
Traditional
Programs in R/3
BADI Eg: Multiple Projects

BSP

Web Dynpro

Workflow
OO Terminology: Keywords

1. Class Blue print of Object

2. Object Instance of class

3. Method Procedure, which perform unique operation

4. Encapsulation Protecting our data

5. Polymorphism Different behaviors at diff. instances

6. Abstraction Hiding our irrelevance data

7. Inheritance one property of object is acquiring to another property of object


Class

 Class : A Class is a user defined data type

with attributes, methods , types and events

for a particular business scenario or business application.  Class will be created Locally or Globally.

OR o Steps to work with Local class Program.


Step1: Define Class.
Blueprint for Objects. Step2: Implement Class.
Step3: Declare Reference Variable. SE38
 Class creation is of 2 steps: Step4: Create Instance.
1. Define a class. Step5: Addressing Class Components using Instance.
2. Implement class.
o Steps to work with Global class Program.
 Syntax for Define a class. Step1: Define Class. SE24
CLASS < CLASSNAME > DEFINITION. Step2: Implement Class.
< VISIBILITY SCOPE >. Step3: Declare Reference Variable.
< COMPONENTS >. Step4: Create Instance. SE38
ENDCLASS. Step5: Addressing Class Components using Instance.

 Syntax for Implement a class.

CLASS < CLASSNAME > IMPLEMENTATION.


< METHODS IMPLEMENTATION >.
ENDCLASS.
2. Creating Class & Objects
Working with Local & Global Class

 Local class Program  Global class Program

 Double click on M1, Enter above code.

SE24

SE38

SE38
Working with Local & Global class Internal Tables

 Local class Program

SE38
Global class Program

SE11

SE11 SE11

SE24

Double click on Methods, Enter the code

SE38
3. Working with Local & Global class Methods

SE24

Specify Import & Export values under Parameters Tab.

Double click on Method, Write the above code.

SE38
Working with Local & Global class Constructor
4. Working with Local & Global class Events
5. Abstraction & Encapsulation

 Encapsulation and Abstraction both are interrelated terms.

 Building Example:
In our city we daily see number of beautiful buildings every day.
We can live in this building, we can use stairs, lift and other facilities of these buildings
can we estimate how much material used for making this building ,
how many man power , hours required for making this type of building, probably no because building is hiding all these things with us.
6.Inheritance

 Class concept supports Single & Multiple level Inheritance  Interface concept supports Multiple Inheritance

Single Level
Inheritance Multi Level Inheritance Multiple Inheritance

Class Method Method


Super Class / Parent Class Class
(C1) (M1) (M2)
(C1)

Class Class
Sub Class / Child Class (C2)
(C2) Class
(C1)

Class
(C3)
Working with Local Class: Inheritance
Working with Global Class: Inheritance

Double click on Method, Write the above code.

Execute Transaction SE24, Create a Class ZCL_SAMPLE8

Execute Transaction SE24, Create a Class ZCL_SAMPLE9

Double click on Method, Write the above code.

Execute Transaction SE38, Write the above code.


 Interface extend the scope of class.
 It can be Implemented in class.
 It contain only Definition Part, No Implementation.
 Interfaces are 2 Types:
1. Local Interface.
7. Working with Interfaces: Local & Global Programs 2. Global Interface.
8. Polymorphism

Poly - Many Morphs - Forms

Method Functionality changes class to class.

Class (C1)

OBJ1 Method
(M1)

Class (C2) Class (C3)

M1 M1
Redefinition Redefinition

OBJ2 OBJ3
Working with Polymorphism: Local Program
Working with Polymorphism: Global Program

Class (C2)

Class (C1)

Class (C3)
9. Business Requirement: Display Customer Master Data based on Customer Number

After Designing Click on & Uncomment PBO Write the code.

IT_KNA1

Database
Business Requirement : Display Customer Master Required columns Data based on Customer Number
MODULE POOL PROG
THANK YOU
SR KRISHNA

BY SR KRISHNA
MAIL ID: [email protected]

You might also like