0% found this document useful (0 votes)
45 views14 pages

Oops Abap

Basics of Object oriented programming in SAP ABAP
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)
45 views14 pages

Oops Abap

Basics of Object oriented programming in SAP ABAP
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/ 14

s

OOPS ABAP BASICS


AUTHOR – SUSHANT SINGH CHHATRYA

SAP ABAP CONSULTANT

JULY 5, 2024
INVENIOLSI

SUSHANT SINGH 0
OOPS ABAP

Classes in SAP ABAP

Types of Method

Access Specifier

SUSHANT SINGH 1
Types of Parameters

Classes in SAP ABAP – Global Class

Creating an Object

➔ Create a Global Usual ABAP Class: Call it in a program:


➔ Instance Method: Create an object to it:

➔ Very Important to create object of this class:

SUSHANT SINGH 2
➔ Here, we have created exception ‘wrong_input’ in global class:

➔ IF Static Method, call using class in name:

SUSHANT SINGH 3
Note: Diff b/w TYPE and TYPE TABLE OF:

- TYPE: Use to assign component as it is, be it be structure or table type.


- Because of above, we always create table types for global class table parameters.
(As only TYPE is available there)
- TYPE TABLE OF: Used in Program to declare internal table as of structure.

Note: This class method is a Modularization technique.


We are dividing the program into small-small units:

4 types: Include Program, FM, Subroutine, call method.

➔ Inheritance in Global Class:

➔ Classes in SAP ABAP – Local Class

SUSHANT SINGH 4
➔ OOPS Concepts:

Inheritance: Reusability

SUSHANT SINGH 5
Abstract class - Cannot be instantiated - because they are not fully Classs
or Fully Implemented.

➔ In global class: Abstract class:

➔ Convert method to abstract:

SUSHANT SINGH 6
➔ Must redefine this method, to convert it into non-abstract method

➔ Redefine button:

Note: With the help of abstract class, we can exhibit polymorphism

SUSHANT SINGH 7
➔ Interface:

Create Global Interface from SE24:

Note: From it we can also achieve polymorphism

Use that Interface in any number of sub-class

SUSHANT SINGH 8
Method in sub-class: Via Interface

➔ Local Interface:

SUSHANT SINGH 9
➔ Imp Difference:

Multiple Inheritance: In SE24: We can define only one super-class, means multiple
inheritance is not possible through abstract class:

SUSHANT SINGH 10
➔ Below class has 2 parent or 2 interface:

SUSHANT SINGH 11
➔ We can also see it locally:

SUSHANT SINGH 12
SUSHANT SINGH 13

You might also like