SlideShare a Scribd company logo
1 of 25
Lecture 13 ABAP Objects BCO5647 Applications Programming Techniques (ABAP)
Readings & Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Procedural Programming Model ,[object Object],[object Object],[object Object],Data Data Data Data Data Function Function Function Function Function Function Function Function
The Procedural Programming Model ,[object Object],[object Object],[object Object],[object Object],report . . . *-------------------------------- types: . . . data: . . . . . . perform form1 . . . call function ‘FB1’. . . . call function ‘FB2’. . . . *-------------------------------- form f1 . . .   . . . endform.
The Object Oriented Programming Model Encapsulation of Data and Functions
The Object Oriented Programming Model ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],lcl_class Attribute Attribute Attribute Method Method
The Object Oriented Programming Model ,[object Object],[object Object],report . . . *-------------------------------- data: counter type i.   wa type kna1. . . . class lcl_car definition.   . . . endclass. *------  main program ------ counter = counter + 1. create object . . . move wa to . . .
The Object Oriented Programming Model ,[object Object],[object Object],[object Object],[object Object],[object Object]
Unified Modeling Language  (UML) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
UML Representation of a Class ,[object Object],[object Object],[object Object]
UML Class Diagram A class diagram describes all  static  relationships between the classes. There are two basic forms of static relationships: Association In this example: A customer books a car at a rental car company. Generalization / Specialization In this example: A car, a bus, and a truck are all vehicles.
OO Definitions :  Objects ,[object Object],[object Object],[object Object]
OO Definitions :  Classes ,[object Object],[object Object]
Class Definition :  Syntax CLASS  <classname>  DEFINITION. . . . ENDCLASS. CLASS  <classname>  IMPLEMENTATION. . . . ENDCLASS.   ,[object Object],[object Object],[object Object]
Class Definition : Example REPORT EXAMPLE01 . *  Class Definitions. CLASS lcl_airplane DEFINITION. PUBLIC SECTION. DATA:  name  type string, weight  type i, carrier  type string. METHODS: add_airplane, display_airplane, ENDCLASS. * *  Class Implementations. * CLASS lcl_airplane IMPLEMENTATION. METHOD add_airplane. . . . ENDMETHOD. METHOD display_airplane. . . . ENDMETHOD. ENDCLASS.
OO Definitions :  Attributes ,[object Object],[object Object],[object Object],CLASS  <classname>  DEFINITION. PRIVATE SECTION. . . .   types: . . .   constants: . . .   data:  variable1  type  local-type ,   variable2  type  global_type ,   variable3  like variable1, variable4  type . . . read-only. variable5  type ref to  class-name ,   variable6  type ref to  type-name.
OO Definitions :  Methods ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Class Methods :  Syntax CLASS  <classname>  DEFINITION. . . . METHODS:  <methodname>   IMPORTING . . .   EXPORTING . . .   CHANGING  . . .   RETURNING . . .   EXCEPTIONS . . . ENDCLASS. CLASS  <classname>  IMPLEMENTATION. METHOD  <methodname>   . . .   ENDMETHOD ENDCLASS.
Class Methods : Example REPORT EXAMPLE02. CLASS lcl_airplane DEFINITION. PUBLIC SECTION. DATA:  name  type string, weight  type i, carrier  type string. METHODS: init_airplane importing iname  type string iweight type i,   display_airplane. ENDCLASS. CLASS lcl_airplane IMPLEMENTATION. METHOD init_airplane. name  = iname. weight  = iweight. carrier = ‘LH’. ENDMETHOD. METHOD display_airplane. write:/ ‘name  :', name. ENDMETHOD. ENDCLASS.
Creating Objects ,[object Object],[object Object],[object Object],[object Object],[object Object]
Creating Objects : Example REPORT EXAMPLE03. CLASS lcl_airplane DEFINITION. PUBLIC SECTION. DATA:  . . . METHODS: . . . ENDCLASS. CLASS lcl_airplane IMPLEMENTATION. METHOD init_airplane. . . . ENDMETHOD. METHOD display_airplane. . . . ENDMETHOD. ENDCLASS. START-OF-SELECTION. DATA : airplane1 TYPE REF to lcl_airplane, airplane2 TYPE REF to lcl_airplane. CREATE OBJECT airplane1. CREATE OBJECT airplane2. CALL METHOD airplane1->init_airplane   exporting iname = ‘DC40’ iweight = 3500. CALL METHOD airplane1->display_airplane.
Assigning References In the previous example, the CREATE OBJECT statement creates an object in the main memory.  If the following statement is added after the objects have been created : airplane1 = airplane2 The reference variables will be assigned to each other. Once it has been assigned, airplane1 points to the same object as reference airplane2.
Constructors CREATE OBJECT ,[object Object],[object Object],[object Object],[object Object],lcl_airplane name weight count constructor
Constructors : Example REPORT EXAMPLE04. CLASS lcl_airplane DEFINITION. PUBLIC SECTION. DATA:  name  type string, weight  type i, carrier  type string. METHODS: constructor importing   icarrier type string. ENDCLASS. CLASS lcl_airplane IMPLEMENTATION. METHOD constructor.   Carrier = icarrier. ENDMETHOD. ENDCLASS. START-OF-SELECTION. DATA : airplane1 TYPE REF to lcl_airplane, airplane2 TYPE REF to lcl_airplane. CREATE OBJECT airplane1 exporting    icarrier = ‘LH’. CREATE OBJECT airplane2 exporting   icarrier = ‘QA’.
Inheritance ,[object Object],[object Object],[object Object]

More Related Content

What's hot

Java Chapter 04 - Writing Classes: part 4
Java Chapter 04 - Writing Classes: part 4Java Chapter 04 - Writing Classes: part 4
Java Chapter 04 - Writing Classes: part 4
DanWooster1
 
Interfaces In Java
Interfaces In JavaInterfaces In Java
Interfaces In Java
parag
 

What's hot (20)

Objectorientedprogrammingmodel1
Objectorientedprogrammingmodel1Objectorientedprogrammingmodel1
Objectorientedprogrammingmodel1
 
Oops in vb
Oops in vbOops in vb
Oops in vb
 
Java interfaces & abstract classes
Java interfaces & abstract classesJava interfaces & abstract classes
Java interfaces & abstract classes
 
Java Chapter 04 - Writing Classes: part 4
Java Chapter 04 - Writing Classes: part 4Java Chapter 04 - Writing Classes: part 4
Java Chapter 04 - Writing Classes: part 4
 
Java interface
Java interfaceJava interface
Java interface
 
What are Abstract Classes in Java | Edureka
What are Abstract Classes in Java | EdurekaWhat are Abstract Classes in Java | Edureka
What are Abstract Classes in Java | Edureka
 
Structure of java program diff c- cpp and java
Structure of java program  diff c- cpp and javaStructure of java program  diff c- cpp and java
Structure of java program diff c- cpp and java
 
Basics of Java
Basics of JavaBasics of Java
Basics of Java
 
Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)
 
Opps
OppsOpps
Opps
 
Unit 3 Java
Unit 3 JavaUnit 3 Java
Unit 3 Java
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorials
 
javainterface
javainterfacejavainterface
javainterface
 
Abstraction in java [abstract classes and Interfaces
Abstraction in java [abstract classes and InterfacesAbstraction in java [abstract classes and Interfaces
Abstraction in java [abstract classes and Interfaces
 
Beginners Guide to Object Orientation in PHP
Beginners Guide to Object Orientation in PHPBeginners Guide to Object Orientation in PHP
Beginners Guide to Object Orientation in PHP
 
Ppt chapter03
Ppt chapter03Ppt chapter03
Ppt chapter03
 
Abstract class
Abstract classAbstract class
Abstract class
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
 
Interfaces In Java
Interfaces In JavaInterfaces In Java
Interfaces In Java
 
Class method
Class methodClass method
Class method
 

Viewers also liked

Lecture08 abap on line
Lecture08 abap on lineLecture08 abap on line
Lecture08 abap on line
Milind Patil
 
Lecture16 abap on line
Lecture16 abap on lineLecture16 abap on line
Lecture16 abap on line
Milind Patil
 
0100 welcome
0100 welcome0100 welcome
0100 welcome
vkyecc1
 
Lecture05 abap on line
Lecture05 abap on lineLecture05 abap on line
Lecture05 abap on line
Milind Patil
 
Lecture12 abap on line
Lecture12 abap on lineLecture12 abap on line
Lecture12 abap on line
Milind Patil
 
Lecture04 abap on line
Lecture04 abap on lineLecture04 abap on line
Lecture04 abap on line
Milind Patil
 
Lecture09 abap on line
Lecture09 abap on lineLecture09 abap on line
Lecture09 abap on line
Milind Patil
 
Lecture06 abap on line
Lecture06 abap on lineLecture06 abap on line
Lecture06 abap on line
Milind Patil
 
Lecture14 abap on line
Lecture14 abap on lineLecture14 abap on line
Lecture14 abap on line
Milind Patil
 
Chapter 04 sap script - output program
Chapter 04 sap script - output programChapter 04 sap script - output program
Chapter 04 sap script - output program
Kranthi Kumar
 
Abap slide lockenqueuedataclustersauthchecks
Abap slide lockenqueuedataclustersauthchecksAbap slide lockenqueuedataclustersauthchecks
Abap slide lockenqueuedataclustersauthchecks
Milind Patil
 
0103 navigation
0103 navigation0103 navigation
0103 navigation
vkyecc1
 
Abap slide exceptionshandling
Abap slide exceptionshandlingAbap slide exceptionshandling
Abap slide exceptionshandling
Milind Patil
 
Abap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checksAbap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checks
Milind Patil
 
Lecture11 abap on line
Lecture11 abap on lineLecture11 abap on line
Lecture11 abap on line
Milind Patil
 
0106 debugging
0106 debugging0106 debugging
0106 debugging
vkyecc1
 
Abap slide class4 unicode-plusfiles
Abap slide class4 unicode-plusfilesAbap slide class4 unicode-plusfiles
Abap slide class4 unicode-plusfiles
Milind Patil
 

Viewers also liked (20)

Lecture08 abap on line
Lecture08 abap on lineLecture08 abap on line
Lecture08 abap on line
 
Lecture16 abap on line
Lecture16 abap on lineLecture16 abap on line
Lecture16 abap on line
 
0100 welcome
0100 welcome0100 welcome
0100 welcome
 
Lecture05 abap on line
Lecture05 abap on lineLecture05 abap on line
Lecture05 abap on line
 
Lecture12 abap on line
Lecture12 abap on lineLecture12 abap on line
Lecture12 abap on line
 
Lecture04 abap on line
Lecture04 abap on lineLecture04 abap on line
Lecture04 abap on line
 
Lecture09 abap on line
Lecture09 abap on lineLecture09 abap on line
Lecture09 abap on line
 
Lecture06 abap on line
Lecture06 abap on lineLecture06 abap on line
Lecture06 abap on line
 
control techniques
control techniquescontrol techniques
control techniques
 
Lecture14 abap on line
Lecture14 abap on lineLecture14 abap on line
Lecture14 abap on line
 
Chapter 04 sap script - output program
Chapter 04 sap script - output programChapter 04 sap script - output program
Chapter 04 sap script - output program
 
Abap slide lockenqueuedataclustersauthchecks
Abap slide lockenqueuedataclustersauthchecksAbap slide lockenqueuedataclustersauthchecks
Abap slide lockenqueuedataclustersauthchecks
 
0103 navigation
0103 navigation0103 navigation
0103 navigation
 
Abap slide exceptionshandling
Abap slide exceptionshandlingAbap slide exceptionshandling
Abap slide exceptionshandling
 
Abap slide class3
Abap slide class3Abap slide class3
Abap slide class3
 
Abap slides set1
Abap slides set1Abap slides set1
Abap slides set1
 
Abap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checksAbap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checks
 
Lecture11 abap on line
Lecture11 abap on lineLecture11 abap on line
Lecture11 abap on line
 
0106 debugging
0106 debugging0106 debugging
0106 debugging
 
Abap slide class4 unicode-plusfiles
Abap slide class4 unicode-plusfilesAbap slide class4 unicode-plusfiles
Abap slide class4 unicode-plusfiles
 

Similar to Lecture13 abap on line

C++ beginner's guide ch08
C++ beginner's guide ch08C++ beginner's guide ch08
C++ beginner's guide ch08
Jotham Gadot
 
Object Oriended Programming with Java
Object Oriended Programming with JavaObject Oriended Programming with Java
Object Oriended Programming with Java
Jakir Hossain
 
Ap Power Point Chpt4
Ap Power Point Chpt4Ap Power Point Chpt4
Ap Power Point Chpt4
dplunkett
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2
Rakesh Madugula
 
ActionScript 3.0 Fundamentals
ActionScript 3.0 FundamentalsActionScript 3.0 Fundamentals
ActionScript 3.0 Fundamentals
Saurabh Narula
 
Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)
Vu Tran Lam
 

Similar to Lecture13 abap on line (20)

Intro to iOS Development • Made by Many
Intro to iOS Development • Made by ManyIntro to iOS Development • Made by Many
Intro to iOS Development • Made by Many
 
C++ beginner's guide ch08
C++ beginner's guide ch08C++ beginner's guide ch08
C++ beginner's guide ch08
 
OOP and C++Classes
OOP and C++ClassesOOP and C++Classes
OOP and C++Classes
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Lecture 4. mte 407
Lecture 4. mte 407Lecture 4. mte 407
Lecture 4. mte 407
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
 
Object Oriended Programming with Java
Object Oriended Programming with JavaObject Oriended Programming with Java
Object Oriended Programming with Java
 
iOS development introduction
iOS development introduction iOS development introduction
iOS development introduction
 
Class objects oopm
Class objects oopmClass objects oopm
Class objects oopm
 
Object & classes
Object & classes Object & classes
Object & classes
 
C++ Notes
C++ NotesC++ Notes
C++ Notes
 
My c++
My c++My c++
My c++
 
Ap Power Point Chpt4
Ap Power Point Chpt4Ap Power Point Chpt4
Ap Power Point Chpt4
 
OOC MODULE1.pptx
OOC MODULE1.pptxOOC MODULE1.pptx
OOC MODULE1.pptx
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2
 
ActionScript 3.0 Fundamentals
ActionScript 3.0 FundamentalsActionScript 3.0 Fundamentals
ActionScript 3.0 Fundamentals
 
Object-oriented programming (OOP) with Complete understanding modules
Object-oriented programming (OOP) with Complete understanding modulesObject-oriented programming (OOP) with Complete understanding modules
Object-oriented programming (OOP) with Complete understanding modules
 
Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)
 
Oops
OopsOops
Oops
 
Object Oriented Programming (Advanced )
Object Oriented Programming   (Advanced )Object Oriented Programming   (Advanced )
Object Oriented Programming (Advanced )
 

More from Milind Patil

Step by step abap_input help or lov
Step by step abap_input help or lovStep by step abap_input help or lov
Step by step abap_input help or lov
Milind Patil
 
Step bystep abap_fieldhelpordocumentation
Step bystep abap_fieldhelpordocumentationStep bystep abap_fieldhelpordocumentation
Step bystep abap_fieldhelpordocumentation
Milind Patil
 
Step bystep abap_field help or documentation
Step bystep abap_field help or documentationStep bystep abap_field help or documentation
Step bystep abap_field help or documentation
Milind Patil
 
Abap slides user defined data types and data
Abap slides user defined data types and dataAbap slides user defined data types and data
Abap slides user defined data types and data
Milind Patil
 
Step bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecordStep bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecord
Milind Patil
 
Step bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecordStep bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecord
Milind Patil
 
Lecture10 abap on line
Lecture10 abap on lineLecture10 abap on line
Lecture10 abap on line
Milind Patil
 
Lecture07 abap on line
Lecture07 abap on lineLecture07 abap on line
Lecture07 abap on line
Milind Patil
 
Lecture03 abap on line
Lecture03 abap on lineLecture03 abap on line
Lecture03 abap on line
Milind Patil
 
Lecture02 abap on line
Lecture02 abap on lineLecture02 abap on line
Lecture02 abap on line
Milind Patil
 
Lecture01 abap on line
Lecture01 abap on lineLecture01 abap on line
Lecture01 abap on line
Milind Patil
 
Lecture15 abap on line
Lecture15 abap on lineLecture15 abap on line
Lecture15 abap on line
Milind Patil
 
Abap course chapter 6 specialities for erp software
Abap course   chapter 6 specialities for erp softwareAbap course   chapter 6 specialities for erp software
Abap course chapter 6 specialities for erp software
Milind Patil
 
Abap course chapter 5 dynamic programs
Abap course   chapter 5 dynamic programsAbap course   chapter 5 dynamic programs
Abap course chapter 5 dynamic programs
Milind Patil
 

More from Milind Patil (15)

Step by step abap_input help or lov
Step by step abap_input help or lovStep by step abap_input help or lov
Step by step abap_input help or lov
 
Step bystep abap_fieldhelpordocumentation
Step bystep abap_fieldhelpordocumentationStep bystep abap_fieldhelpordocumentation
Step bystep abap_fieldhelpordocumentation
 
Step bystep abap_field help or documentation
Step bystep abap_field help or documentationStep bystep abap_field help or documentation
Step bystep abap_field help or documentation
 
Abap slides user defined data types and data
Abap slides user defined data types and dataAbap slides user defined data types and data
Abap slides user defined data types and data
 
Step bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecordStep bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecord
 
Step bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecordStep bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecord
 
Abap reports
Abap reportsAbap reports
Abap reports
 
Lecture10 abap on line
Lecture10 abap on lineLecture10 abap on line
Lecture10 abap on line
 
Lecture07 abap on line
Lecture07 abap on lineLecture07 abap on line
Lecture07 abap on line
 
Lecture03 abap on line
Lecture03 abap on lineLecture03 abap on line
Lecture03 abap on line
 
Lecture02 abap on line
Lecture02 abap on lineLecture02 abap on line
Lecture02 abap on line
 
Lecture01 abap on line
Lecture01 abap on lineLecture01 abap on line
Lecture01 abap on line
 
Lecture15 abap on line
Lecture15 abap on lineLecture15 abap on line
Lecture15 abap on line
 
Abap course chapter 6 specialities for erp software
Abap course   chapter 6 specialities for erp softwareAbap course   chapter 6 specialities for erp software
Abap course chapter 6 specialities for erp software
 
Abap course chapter 5 dynamic programs
Abap course   chapter 5 dynamic programsAbap course   chapter 5 dynamic programs
Abap course chapter 5 dynamic programs
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Lecture13 abap on line

  • 1. Lecture 13 ABAP Objects BCO5647 Applications Programming Techniques (ABAP)
  • 2.
  • 3.
  • 4.
  • 5. The Object Oriented Programming Model Encapsulation of Data and Functions
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. UML Class Diagram A class diagram describes all static relationships between the classes. There are two basic forms of static relationships: Association In this example: A customer books a car at a rental car company. Generalization / Specialization In this example: A car, a bus, and a truck are all vehicles.
  • 12.
  • 13.
  • 14.
  • 15. Class Definition : Example REPORT EXAMPLE01 . * Class Definitions. CLASS lcl_airplane DEFINITION. PUBLIC SECTION. DATA: name type string, weight type i, carrier type string. METHODS: add_airplane, display_airplane, ENDCLASS. * * Class Implementations. * CLASS lcl_airplane IMPLEMENTATION. METHOD add_airplane. . . . ENDMETHOD. METHOD display_airplane. . . . ENDMETHOD. ENDCLASS.
  • 16.
  • 17.
  • 18. Class Methods : Syntax CLASS <classname> DEFINITION. . . . METHODS: <methodname> IMPORTING . . . EXPORTING . . . CHANGING . . . RETURNING . . . EXCEPTIONS . . . ENDCLASS. CLASS <classname> IMPLEMENTATION. METHOD <methodname> . . . ENDMETHOD ENDCLASS.
  • 19. Class Methods : Example REPORT EXAMPLE02. CLASS lcl_airplane DEFINITION. PUBLIC SECTION. DATA: name type string, weight type i, carrier type string. METHODS: init_airplane importing iname type string iweight type i, display_airplane. ENDCLASS. CLASS lcl_airplane IMPLEMENTATION. METHOD init_airplane. name = iname. weight = iweight. carrier = ‘LH’. ENDMETHOD. METHOD display_airplane. write:/ ‘name :', name. ENDMETHOD. ENDCLASS.
  • 20.
  • 21. Creating Objects : Example REPORT EXAMPLE03. CLASS lcl_airplane DEFINITION. PUBLIC SECTION. DATA: . . . METHODS: . . . ENDCLASS. CLASS lcl_airplane IMPLEMENTATION. METHOD init_airplane. . . . ENDMETHOD. METHOD display_airplane. . . . ENDMETHOD. ENDCLASS. START-OF-SELECTION. DATA : airplane1 TYPE REF to lcl_airplane, airplane2 TYPE REF to lcl_airplane. CREATE OBJECT airplane1. CREATE OBJECT airplane2. CALL METHOD airplane1->init_airplane exporting iname = ‘DC40’ iweight = 3500. CALL METHOD airplane1->display_airplane.
  • 22. Assigning References In the previous example, the CREATE OBJECT statement creates an object in the main memory. If the following statement is added after the objects have been created : airplane1 = airplane2 The reference variables will be assigned to each other. Once it has been assigned, airplane1 points to the same object as reference airplane2.
  • 23.
  • 24. Constructors : Example REPORT EXAMPLE04. CLASS lcl_airplane DEFINITION. PUBLIC SECTION. DATA: name type string, weight type i, carrier type string. METHODS: constructor importing icarrier type string. ENDCLASS. CLASS lcl_airplane IMPLEMENTATION. METHOD constructor. Carrier = icarrier. ENDMETHOD. ENDCLASS. START-OF-SELECTION. DATA : airplane1 TYPE REF to lcl_airplane, airplane2 TYPE REF to lcl_airplane. CREATE OBJECT airplane1 exporting icarrier = ‘LH’. CREATE OBJECT airplane2 exporting icarrier = ‘QA’.
  • 25.

Editor's Notes

  1. Data and functions are usually kept separate in the procedural programming model. Generally, global variables for a program contain data, subroutines contain functions. Essentially, every subprogram can access every variable. This means that the programming model itself does not support consistent access to some related parts of the data.
  2. A typical procedural ABAP program consists of type definitions and data declarations, which describe the structure of the data the program uses when it is executed. Modularization units, for example, subroutines or function modules can be encapsulated. However, on the main program level, there is no special protection for the data objects. Any variables can be accessed by any means.
  3. Object orientation focuses on objects that represent either abstract or concrete things in the real world. They are first viewed in terms of their characteristics, which are mapped using the object’s internal structure and attributes (data). The behavior of an object is described through methods and events (functionality). Objects form capsules containing the data itself and the behavior of that data. Objects should enable you to draft a software solution that is a one-to-one mapping of the real-life problem area.
  4. Object orientation focuses on objects that represent either abstract or concrete things in the real world. They are first viewed in terms of their characteristics, which are mapped using the object’s internal structure and attributes (data). The behavior of an object is described through methods and events (functionality). Objects form capsules containing the data itself and the behavior of that data. Objects should enable you to draft a software solution that is a one-to-one mapping of the real-life problem area.
  5. ABAP Objects is not a new language, but has been designed as a systematic extension of ABAP. All of the extensions, including the old procedural parts, are upwardly compatible. Type checks in the object-oriented contexts of ABAP Objects are stricter than those in the procedural contexts. In developing ABAP Objects, the ABAP language was cleaned up, in particular in the object-oriented contexts. This means that obsolete statements lead to syntax errors. However, it is also advisable to avoid obsolete statements in the purely procedural environment, as this creates source texts that are safer and more flexible. Nevertheless, as the language is upwardly compatible, it is not possible to prevent the use of such statements entirely.
  6. Consistency throughout the software development process The “language” used in the various phases of software development (analysis, specification, design and implementation) is uniform. The ideal would be for changes made during the implementation phase to flow back into the design automatically. Encapsulation Encapsulation means that the implementation of an object is hidden from other components in the system, so that they cannot make assumptions about the internal status of the object and therefore dependencies on specific implementations do not arise. Polymorphism Polymorphism (ability to have multiple forms) in the context of object technology signifies that objects in different classes have different reactions to the same message. Inheritance Inheritance defines the implementation relationship between classes, in which one class (the subclass) shares the structure and the behavior defined in one or more other classes (superclasses). Note: ABAP Objects only allows single inheritance.
  7. UML (Unified Modeling Language) is a standardized modeling language. It is used for the specification, construction, visualization and documentation of models for software systems and enables uniform communication between various users. UML does not describe the steps in the object-oriented development process. UML is an industry standard and has been standardized by the OMG (Object Management Group) since September 1997 as UML Version 1.1. The members of the OMG are continuously developing it further. SAP uses UML as the company-wide standard for object-oriented modeling. You can find the UML specifications on the OMG homepage at: http://www.omg.org
  8. A class is represented by a rectangle in UML notation. First, the class’s name is given, then its attributes, and finally its methods. However, you also have the option of omitting the attribute part and/or the method part. Attributes describe the data that can be stored in the objects of a class. They also determine the status of an object. Methods describe the functions that an object can perform. They therefore determine the object’s behavior.
  9. A class diagram describes all static relationships between the classes. There are two basic forms of static relationships: Association In this example: A customer books a car at a rental car company. Generalization / Specialization In this example: A car, a bus, and a truck are all vehicles. Note: As mentioned previously, classes can also be shown in class diagrams with their attributes and methods. Here, these have been left out to improve clarity.
  10. The object in the above model has two layers: an outer shell and an inner core. Users can only see the outer shell, while the inner core remains hidden (the internal status of an object can only be seen within the object itself). Public components (outer shell): the outer shell contains the components of the object that are visible to users, such as attributes (data), methods (functions) and events. All users have direct access to these components. The public components of an object form its external point of contact. Private components (inner core): the components of the inner core (attributes, methods and events) are only visible within the object itself. The attributes of an object are generally private. These private attributes of an object can only be accessed using the methods of that object itself. Why are the private components of an object “hidden”? This principle is called “information hiding” or “encapsulation” and is used to protect the user. Let us assume that an object changes its private components, while its external point of contact remains unchanged. Any user who simply needs to access the object’s external point of contact can carry on working with the object as usual. The user does not notice the change. However, if an object changes its public components, then any user who accesses these public components must take these changes into account.
  11. In the real world, there are objects, such as various airplanes and plane tickets. Some of these objects are very similar, that is, they can be described using the same attributes or characteristics and provide the same functions. Similar objects are grouped together in classes. Each class is described once, and each object is then created in accordance with this blueprint. A class is therefore a description of a quantity of objects characterized by the same structure and the same behavior. An object is a concrete example of a class, the airplane class is a description of the objects LH Munich, LH New York etc.. Objects that belong to the same class have the same attributes and can be accessed using the same methods. There is only one of each class within a software system, but each class can contain several objects.
  12. A class is a description of a number of objects that have the same structure and the same behavior. A class is therefore like a blueprint, in accordance with which all objects in that class are created. The components of the class are defined in the definition part. The components are attributes, methods, events, constants, types and implemented interfaces. Only methods are implemented in the implementation part. The CLASS statement cannot be nested, that is, you cannot define a class within a class.
  13. Note the sections within the Class definition . ABAP Objects supports three visibility sections in a class : PUBLIC : All components in this section are public and can be addressed by all users and methods. They form the external interface of the class. PROTECTED : The components of this section are protected and can be addressed by the methods of subclasses (inheritance) and methods of the class itself. PRIVATE : Components of this section are private and can only be used in the methods of the class itself.
  14. In classes, you can only use the TYPE addition to refer to data types . You can only use the LIKE reference for local data objects . The READ-ONLY addition means that a public attribute that was declared with DATA can be read from outside, but can only be changed by methods in the same class. You can currently only use the READ-ONLY addition in the public visibility section (PUBLIC SECTION) of a class declaration or in an interface definition. Using TYPE REF TO, an attribute can be typed as any reference.
  15. Methods are internal procedures in classes that determine the behavior of the objects. They can access all attributes in their class and can therefore change the state of other elements. Methods have a signature (interface parameters and exceptions) that enables them to receive values when they are called and pass values back to the calling program. Methods can have any number of IMPORTING, EXPORTING, and CHANGING parameters. All parameters can be passed by value or reference.
  16. In ABAP Objects, methods can have IMPORTING, EXPORTING, CHANGING and RETURNING parameters as well as EXCEPTIONS. All parameters can be passed by value or reference. You can define a return code for methods using RETURNING. You can only do this for a single parameter, which additionally must be passed as a value. Also, you cannot then define EXPORTING and CHANGING parameters. You can define functional methods using the RETURNING parameter (explained in more detail below). All input parameters (IMPORTING, CHANGING parameters) can be defined as optional parameters in the declaration using the OPTIONAL or DEFAULT additions. These parameters then do not necessarily have to be passed when the object is called. If you use the OPTIONAL addition, the parameter remains initialized according to type, whereas the DEFAULT addition allows you to enter a start value.
  17. A class contains the generic description of an object. It describes all the characteristics that are common to all the objects in that class. During the program runtime, the class is used to create specific objects (instances). This process is called instantiation. Example: The object LH Berlin is created during runtime in the main memory by instantiation from the lcl_airplane class. The lcl_airplane class itself does not exist as an independent runtime object in ABAP Objects. Realization: Objects are instantiated using the statement: CREATE OBJECT. During instantiation, the runtime environment dynamically requests main memory space and assigns it to the object.
  18. Reference variables can also be assigned to each other. The above example shows that once it has been assigned, airplane1 points to the same object as reference airplane2. As soon as no more references point to an object, the Garbage Collector removes it from the memory. The Garbage Collector is a system routine that automatically deletes objects that can no longer be addressed from the main memory and releases the memory space they occupied.
  19. The constructor is a special (instance) method in a class and is always named CONSTRUCTOR. The following rules apply: Each class has exactly one constructor. The constructor does not need to be defined if no implementation is defined. The constructor is automatically called during runtime within the CREATE OBJECT statement. If you need to implement the constructor, then you must define and implement it in the PUBLIC SECTION. When EXCEPTIONS are triggered in the constructor, instances are not created (as of 4.6a), so no main memory space is taken up. You need to implement the constructor when, for example You need to allocate (external) resources You need to initialize attributes that cannot be covered by the VALUE supplement to the DATA statement You need to modify static attributes You cannot normally call the constructor explicitly.
  20. Inheritance is a relationship in which one class (the subclass) inherits all the main characteristics of another class (the superclass). The subclass can also add new components (attributes, methods, and so on) and replace inherited methods with its own implementations. Inheritance is an implementation relationship that emphasizes similarities between classes. In the example above, the similarities between the passenger plane and cargo plane classes are extracted to the airplane superclass. This means that common components are only defined/implemented in the superclass and are automatically present in the subclasses. The inheritance relationship is often described as an “is-a” relationship: a passenger plane is an airplane.