SAP' ABAP
Handbook
Kogent Learning Solutions,
Inc.
JONES AND BARTLETT PUBLISHERS
Sudbury, Massachusetts
BOSTON
TORONTO
LONDON
SINUAPORI:
Table
of
Contents
Introduction About This Book
How to Use This Book Conventions
xxi xxi xxii
xxii
xxiv
Other Resources
Chapter
Gateway
to SAP
Systems
1 2 4
6 8 9
Explaining the Concept of an ERP System
History
of SAP
Systems
Need for ABAP
Exploring The Logical View
the Architecture of SAP R/3
The Software-Oriented View The User-Oriented View
10
13
Explaining Application Server Dispatching Dialog Steps Describing the User Context and Roll Area in the SAP System The Client-Dependency Feature Summary
the Architecture of the
14 22 24 26 26 27 28 31
31
Chapter 2
The
Logon Process of the
SAP
System
Starting the SAP System Maintaining the SAP Logon Screen Adding a New Entry Modifying the Entry Deleting the Entry Creating and Using SAP Shortcuts Creating SAP Shortcuts
35 36 37 37 47
Configuring
the SAP
Logon
ix
Table
of
Contents
Changing the Password
Logging Off of the SAP System Summary
50 52 53 55 56 60 60 67 70 72 75 76 78
80 82 82 84
Chapter 3
SAP
Easy Access
Explaining the SAP Easy Access Screen Exploring the GUI of the SAP System
The Screen Header The Screen
Body
Customizing Managing Favorites
the SAP GUI
Adding an Item
Inserting Moving Favorites and Folders Renaming Favorites and Folders Deleting Favorites and Folders Adding a Web Address Handling SAP Sessions Creating a New Session Displaying a List of All Sessions Ending a Session Summary Chapter 4 Understanding Exploring
ABAP ABAP ABAP
Folders
84 86 87 88 89 90 91 92
94
Workbench
Overview of ABAP Workbench the ABAP Workbench Tools
Dictionary
Editor
Front-End Editor (New) Front-End Editor (Old) Back-End Editor Class Builder
Function Builder Screen Painter Menu Painter
95 96
98
99 101 102 103
Table
of
Contents
xi
Object Navigator
Message
Maintenance ABAP Text Elements M aintain Transaction
105 109 110 111 112 113 114
114 115
Describing Package
of
Builder
Types Packages Testing Tools in ABAP Workbench ABAP Debugger ABAP Runtime Analysis
Performance
Analysis
ITS BSP
116 117 118 119
120
Describing
Web
Web S ervices
Application Builder for Application Builder for Describing XSLT Editor
Web
Summary
121
Chapter 5
ABAP
Dictionary Dictionary
123 124 125 126 127 128 133 138 138 138 144 144 145 146 148 152 154 158 174
Overview of ABAP
Exploring Domains Describing Fixed Values for Domains Exploring Conversion Routines for Domains
Creating Deleting
a
Domain Domain
Modifying the Existing Domain
a
Exploring
Data Types
Data Elements Structures
Table Types
Exploring Type Groups Exploring Database Tables Types of Tables Types of Table Fields Technical Settings of a Table Creating Tables Relating Tables by Using Foreign Keys
xii
Table
of
Contents
Exploring Views
Relating Using Relational Operators Creating Different Types of Views
Database Tables
180
181 184 211 212 212
Deleting Views Exploring Search Helps Elementary Search Help Collective Search Help Append Search Help Exploring Lock Objects Describing Lock Argu m ents Exploring the Lock Mode and the Lock Table Describing the Lock Mechanism Creating Lock Objects
Summary
213 214 215 217 218 220 222 226
Chapter 6
ABAP
Programming
in ABAP
Editor
227
228
Structure of an ABAP
Program
Part
Introductory Program
229
Declaration Part for Global Data, Class and Selection Screens
Definitions,
229
230 231
Processing Blocks
ABAP Editor
Types
ABAP
of ABAP
Programs
236 238 239 241 242 245 246 248 248 252 256 258
Syntax
Inserting Comments into ABAP Programs Exploring Types and Objects Data Types Object Types Objects in ABAP
Variables in ABAP The
DATA
Statement
in ABAP
The PARAMETERS Statement
Constants The The The
TABLES Statement
Assignment Statements
MOVE Statement MOVE
-
259 259 Statement
263
CORRESPONDING
Table
of
Contents
xiii
The The The
WRITE CLEAR
TO
Statement
265 266 268 268 271 278 278 279 280 289 294 297 299 300 303 303 304 304 305 305 Data Data
Statement Statement
Formatting Options
WRITE
The
FORMAT
Statement
Exploring Dynamic Assignment Describing Flow Control
The
IF.
. .
System Variables
Statements
ENDIF
Control Statement
Looping Terminating Loops Summary
Chapter 7
Internal Tables
Overview of Internal Tables Data Types of an Internal Table
Types
of Internal Tables
Standard Tables
Sorted Tables
Hashed Tables
Creating Creating Internal Tables as Creating Internal Tables as
Internal Tables
Types
306 313 316 316 319 320 320 322 325 333 335 337 346 348 356 364
Objects
Performing Operations on an Entire Internal Table Moving and Assigning Internal Tables
Initializing Internal Tables Refreshing Internal Tables Releasing the Memory of Internal Tables
Comparing
Internal Tables
Sort Operation in Internal Tables Determining the Attributes of Internal Tables Operations on Individual Lines Inserting Lines in Internal Tables Inserting Summarized Lines in Internal Tables
Performing the
Appending Lines to Internal Tables Reading the Lines of Internal Tables Modifying the Lines of Internal Tables
xiv
Table
of
Contents
Deleting Lines Searching Table
Control Break The The The
AT AT
373 Entries 386 390 392
392
Maintaining Internal Tables Processing
FIRST and AT LAST Statements
NEW
and AT
END
OF Statements
395 401 403 410
SUM ON
Statement
CHANGE OF
The
Statement
Summary
Chapter 8
Accessing Data in
the SAP
System
411 412 413 416 417 428 437
446
Accessing Database Tables Open SQL Reading Data Using the SELECT
The The
SELECT INTO
Statement
Clause
Clause
The FROM Clause The WHERE Clause
The The
GROUP BY HAVING
Clause Clause
459 462 463 465
467
Clause
BY
The ORDER
Subqueries Examples of Subqueries Inserting Data into a Database Table
471 472 477 479 483 485 488 490 491
491 494 495
Examples of Data Insertion Updating Data in a Database Table Examples of Updating Data in Tables
Deleting the Data from a Database Table Examples of Deleting Data Modifying the Lines of Database Tables
Using
Cursors
to
Read Data
Opening
and Closing Cursors Data
Retrieving Committing Database Changes Summary
Ta8le of Contents
xv
Chapter
Modularization
Techniques
497 498 503 505 510 513 518 524 526 528 540 543 544 545 548
Working with Subroutines Working with Formal and Actual Parameters Handling Data in Subroutines
Using
Local Field
Symbols
to
Making
Internal and External Calls Parameters
Subroutines Passing Terminating Subroutines by Using EXIT and
CHECK
Statements
Function Modules
Modules Creating Calling Function Modules from ABAP Programs
Function
Source Code Modules
Macros
Include
Programs
Summary
Chapter
10
ABAP
User
Dialogs
549 550
552
555
Introducing Dialog Program ming
Screen Painter
Learning Flow Logic Learning About the Layout Editor The Tabstrip Control in Graphical
Layout Editor
About Attributes
559
561
568
Creating a Layout Editor
Menu Painter
Table Control
by Using Graphical
590 599 600 620 620 638 643 643
Working with Menu Painter Working with Selection Screens Defining a Selection Screen Calling a Selection Screen
Processing Selection Summary
Screens
xvi
Table
of
Contents
Chapter
11
The BDC and LSMW Tools
The Data Transfer The Batch The The
645
Techniques Input Technique Direct Input Technique BAPI Technique Input
Method
646
646 649
649
Data Transfer Methods
649 650 650 651 652 653
The Direct The Batch
Data
The Call Transaction Method
Input with Session Method
BDCDATA Structure
Transfer
by Using the
a
The BDC Tool
Creating
BDC
Program by Using the Call
653
Transaction Method
Transferring
The LSMW Tool
Data by Using the Batch
Input
675
697
with Session Method of BDC
Updating Records by Using the Batch Input Recording Method
Summary Chapter 12
Forms in
698 733
mySAP
ERP:
SAPscript and SAP
Smart Forms
735 736 738 739 743 747 751 762 763 771 787 789
Exploring the SAPscript Tool
Components
of the Structure of an
SAPscript Tool SAPscript Form
Painter Tool
Managing Tools Accessing the Form
Form
Subobjects
The
SAPscript Runtime Environment Print Program SAPscript Function Modules Controlling the SAPscript Forms SAPscript Control Commands SAPscript Symbols
The SAP Smart Forms Tool
Overview of the SAP Smart Forms Tool SAP Smart Form
791
793
794 795
Components
Table
of Contents
xvii
Explaining the Smart
Form Process
798 800 800 801 806 808 810 811 812 814 816 817 818 820 827 829
Advantages of Smart Forms Important Objects for Form Development Creating and Maintaining Smart Forms
Style Builder
Comparing SAPscript Migrating SAPscript Forms Individual Migration Mass Migration Converting a Style Summary Chapter
13
and Smart Forms
to Smart Forms
Reports Working with Classical Reports Creating a Classical Report
Interactive
Reports
an
Creating
Interactive
Report Reports
Comparing ALV Reports
Creating
an
Classical and Interactive
ALV
839 839 840 846
Report
Summary
Chapter
14
Business Add-Ins
(BADIs)
847 848 849 851 854 854 856 858 860
Concept
of BADIs
Enhancement Framework
Overview of Enhancement
The Enhancement Builder Tool Enhancement
Techniques
in
Enhancement Framework
Structure of a BADI
Definition of BADIs
Defining Displaying, Changing, Implementation of BADIs Calling BADIs
a
BADI
or
Deleting a
BADI Definition
869
870
875 875
Differences Between Classic and New BADIs
Filter-Dependent
BADIs
876
xviii
Table
of
Contents
Function Code Enhancements
878
Screen Enhancements
879
880
881 882
Summary Appendix A
Object
Orientation in ABAP
Overview of ABAP
Objects
Concepts
of OOP in ABAP
Explaining Objects
Classes
the Basic
883 884 885 885 885 886 887 887 889
892 893
Interfaces
Encapsulation
Inheritance
Polymorphism
Defining and Implementing a Class Exploring the Components of a Class Visibility Sections in a Class Handling the Objects Declaring and Implementing Interfaces Declaring and Calling Methods Declaring and Calling Constructors Working with Events in ABAP Objects
Triggering Handling an
an
895 898
901
902 903 904 907 908 909 909 910 910 910 911 911 911 912 912
Event
Event
Appendix B Introducing Cross-Application Technologies
Introducing IDoc Exploring the Uses of IDoc EDI Technique
ALE
Technique
Legacy System Integration
Third-Party Product Integration
Workflow Integration SAP R/2 OCR ICR
System
Internet and XML
Integration
Integration Integration
Table
of
Contents
xix
Benefits of the IDoe Interface Describing the IDoc Structure
IDoc Runtime
912 913
917
Components
Control Record Data Records Status Records ALE ALE Architecture RFC RFC Interface of RFC
917 918
918 919
920
924 924
Types
926
927 943
Glossary
Index