ABAP Objects

ABAP Objects

Horst Keller, Sascha Krüger ABAP® Objects ABAP Programming in SAP NetWeaver™ Bonn Ⴇ Boston Contents at a Glance 1 Introduction .................................................. 23 2 A Practical Introduction to ABAP ................. 53 3 Basic Principles of ABAP ............................... 141 4 Classes and Objects ...................................... 177 5 Basic ABAP Language Elements ................... 225 6 Advanced Concepts in ABAP Objects ........... 341 7 Classic ABAP—Events and Procedures ......... 449 8 Error Handling .............................................. 479 9 GUI Programming with ABAP ....................... 513 10 Working with Persistent Data ..................... 705 11 Dynamic Programming ................................. 795 12 External Interfaces ........................................ 841 13 Testing and Analysis Tools ........................... 939 Contents Foreword ...................................................................................... 19 1 Introduction ............................................................. 23 1.1 What Is ABAP? ........................................................... 23 1.1.1 The Evolution of ABAP ................................... 23 1.1.2 Scope of ABAP ............................................... 25 1.1.3 ABAP Development Environment ................... 26 1.1.4 ABAP Programming Model ............................ 26 1.1.5 ABAP and SAP NetWeaver ............................. 29 1.1.6 ABAP or Java? ................................................ 30 1.1.7 ABAP and Java! .............................................. 31 1.2 The Objective of This Book ......................................... 40 1.2.1 Target Audience ............................................. 40 1.2.2 Structure of this Book .................................... 41 1.2.3 Observing Programming Guidelines ................ 46 1.2.4 Syntax Conventions ........................................ 47 1.3 How Can I Use This Book on a Practical Level? ........... 48 1.3.1 Creating the Examples .................................... 48 1.3.2 Goal of the Examples ..................................... 49 1.3.3 Using the Examples ........................................ 49 1.3.4 Releases Described ......................................... 50 1.3.5 Database Tables Used .................................... 50 2 A Practical Introduction to ABAP ............................ 53 2.1 Functionality of the Sample Application ...................... 54 2.2 Getting Started with the ABAP Workbench ................. 54 2.2.1 Entry through SAP Easy Access ....................... 55 2.2.2 The Object Navigator ..................................... 57 2.3 Packages ..................................................................... 60 2.3.1 Package for Local Development Objects ......... 61 2.3.2 Packages for Transportable Develop- ment Objects ................................................. 62 2.3.3 Creating a Package ......................................... 63 2.3.4 Calling the Transport Organizer ...................... 67 2.4 Database Tables .......................................................... 68 2.4.1 Creating a Customer Table ............................. 68 2.4.2 Creating a Data Element ................................ 72 7 Contents 2.4.3 Creating a Domain ........................................ 75 2.4.4 Completing the Customer Table .................... 76 2.4.5 Creating a Search Help .................................. 78 2.4.6 Creating the Rental Car Table ........................ 78 2.4.7 Creating the Reservations Table ..................... 81 2.5 Creating an ABAP Program ........................................ 82 2.5.1 Creating an Auxiliary Program ....................... 82 2.5.2 ABAP Syntax ................................................. 84 2.5.3 General Program Structure ............................ 86 2.5.4 Two “Hello World” Programs ........................ 88 2.5.5 Copying Programs ......................................... 91 2.6 Implementing the Auxiliary Program .......................... 91 2.6.1 Source Code for the Auxiliary Program .......... 92 2.6.2 Chained Statements ...................................... 94 2.6.3 Data Declarations .......................................... 94 2.6.4 Assigning Values to Data Objects .................. 95 2.6.5 Database Accesses ......................................... 95 2.6.6 Exception Handling ....................................... 96 2.6.7 Testing the Auxiliary Program using the ABAP Debugger ...................................... 96 2.6.8 Result of the Auxiliary Program in the Data Browser ................................................ 98 2.7 User Dialog ................................................................ 99 2.7.1 Using a Function Group ................................. 100 2.7.2 Top Include of the Function Group ................ 101 2.7.3 Creating Function Modules ........................... 105 2.7.4 Testing Function Modules ............................. 108 2.8 Application Logic ....................................................... 110 2.8.1 Exception Classes .......................................... 111 2.8.2 Creating a Class for Reservations ................... 112 2.8.3 Creating a Class for Customer Objects ........... 120 2.8.4 Application Program ...................................... 126 2.8.5 Creating a Transaction Code .......................... 129 2.8.6 Executing the Transaction .............................. 131 2.8.7 Reporting ...................................................... 133 2.9 Summary ................................................................... 135 2.10 Using the Keyword Documentation ........................... 136 3 Basic Principles of ABAP .......................................... 141 3.1 ABAP and SAP NetWeaver ......................................... 141 3.1.1 SAP NetWeaver ............................................. 141 8 Contents 3.1.2 The Application Server ................................... 142 3.1.3 The Application Server ABAP ......................... 143 3.1.4 The ABAP Runtime Environment .................... 150 3.1.5 The Text Environment .................................... 151 3.2 ABAP Program Organization and Properties ................ 152 3.2.1 ABAP Program Design .................................... 152 3.2.2 ABAP Program Execution ............................... 155 3.2.3 ABAP Program Calls ....................................... 156 3.2.4 ABAP Program Types ..................................... 159 3.2.5 Other Program Attributes ............................... 162 3.2.6 Processing Blocks ........................................... 164 3.3 Source Code Organization .......................................... 167 3.3.1 Include Programs ........................................... 167 3.3.2 Macros ........................................................... 170 3.4 Software and Memory Organization of AS ABAP ......... 171 3.4.1 AS ABAP as a System ..................................... 171 3.4.2 Application Server .......................................... 171 3.4.3 User Session ................................................... 174 3.4.4 Main Session .................................................. 174 3.4.5 Internal Session .............................................. 175 4 Classes and Objects ................................................. 177 4.1 Object Orientation ..................................................... 177 4.2 Object-Oriented Programming in ABAP ...................... 180 4.3 Classes ........................................................................ 182 4.3.1 Global and Local Classes ................................ 182 4.3.2 Creating Classes ............................................. 183 4.4 Attributes and Methods .............................................. 191 4.4.1 Instance Components and Static Components ......................................... 191 4.4.2 Attributes ...................................................... 192 4.4.3 Methods ........................................................ 194 4.4.4 Using Static Components ............................... 197 4.4.5 Editor Mode of the Class Builder .................... 199 4.5 Data Types as Components of Classes ......................... 200 4.6 Objects and Object References ................................... 202 4.6.1 Creating and Referencing Objects .................. 202 4.6.2 The Self-Reference “me” ................................ 205 4.6.3 Assigning References ...................................... 205 4.6.4 Multiple Instantiation .................................... 207 9 Contents 4.6.5 Object Creation in a Factory Method ............. 209 4.6.6 Garbage Collection ........................................ 212 4.7 Constructors .............................................................. 213 4.7.1 Instance Constructor ..................................... 214 4.7.2 Static Constructor .......................................... 216 4.7.3 Destructors ................................................... 219 4.8 Local Declarations of a Class Pool .............................. 219 4.8.1 Local Types in Class Pools .............................. 220 4.8.2 Local Classes in Class Pools ............................ 220 4.9 Using ABAP Objects on the AS ABAP ......................... 221 4.10 Summary and Perspective .......................................... 224 5 Basic ABAP Language Elements ............................... 225 5.1 Data Types and Data Objects ....................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    120 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us