Table of Contents

Open all
Close all
Acknowledgments
23
Preface
25
The Objective of this Book
25
Target Audience
25
Structure of this Book
26
1 Introduction to ERP and SAP
31
1.1 Historical Overview
31
1.2 Understanding an ERP System
34
1.2.1 What Is ERP?
34
1.2.2 ERP versus Non-ERP Systems
35
1.2.3 Advantages of an ERP System
37
1.3 Introduction to SAP
38
1.3.1 Modules in SAP
38
1.3.2 Types of Users
39
1.3.3 Role of an ABAP Consultant
40
1.3.4 Changing and Adapting the Data Structure
41
1.4 ABAP Overview
44
1.4.1 Types of Applications
44
1.4.2 RICEF Overview
45
1.5 System Requirements
49
1.6 Summary
50
2 Architecture of an SAP System
51
2.1 Introduction to the Three-Tier Architecture
51
2.2 SAP Implementation Overview
53
2.2.1 SAP GUI: Presentation Layer
54
2.2.2 Application Servers and Message Servers: Application Layer
55
2.2.3 Database Server/RDBMS: Database Layer
62
2.2.4 SAP HANA Introduction
65
2.3 Data Structures
69
2.3.1 Client Overview
70
2.3.2 Client-Specific and Cross-Client Data
70
2.3.3 Repository
73
2.3.4 Packages
74
2.3.5 Transport Organizer
75
2.4 Summary
80
3 Introduction to the ABAP Environment
83
3.1 SAP Environment
84
3.1.1 ABAP Programming Environment
84
3.1.2 Logging On to the SAP Environment
84
3.1.3 Elements of the SAP Screen
85
3.1.4 Transaction Codes
88
3.1.5 Opening and Navigating with Transactions
89
3.2 ABAP Workbench Overview
93
3.2.1 ABAP Editor
94
3.2.2 Function Builder
96
3.2.3 Class Builder
97
3.2.4 Screen Painter
98
3.2.5 Menu Painter
100
3.2.6 ABAP Data Dictionary
101
3.2.7 Object Navigator
104
3.3 Eclipse IDE Overview
105
3.4 Summary
110
4 ABAP Programming Concepts
113
4.1 General Program Structure
114
4.1.1 Global Declarations
114
4.1.2 Procedural Area
115
4.2 ABAP Syntax
116
4.2.1 Basic Syntax Rules
116
4.2.2 Chained Statements
117
4.2.3 Comment Lines
118
4.3 ABAP Keywords
119
4.4 Introduction to the TYPE Concept
120
4.4.1 Data Types
121
4.4.2 Data Elements
135
4.4.3 Domains
139
4.4.4 Data Objects
142
4.5 ABAP Statements
146
4.6 Creating Your First ABAP Program
148
4.7 Summary
153
5 Structures and Internal Tables
155
5.1 Defining Structures
156
5.1.1 When to Define Structures
158
5.1.2 Local Structures
159
5.1.3 Global Structures
163
5.1.4 Working with Structures
166
5.1.5 Use Cases
167
5.2 Internal Tables
168
5.2.1 Defining Internal Tables
168
5.2.2 Types of Internal Tables
171
5.2.3 Table Keys
175
5.2.4 Working with Internal Tables
179
5.2.5 Control Break Statements
186
5.3 Introduction to Open SQL Statements
192
5.3.1 Database Overview
194
5.3.2 Selecting Data from Database Tables
202
5.3.3 Selecting Data from Multiple Tables
205
5.4 Processing Data from Databases via Internal Tables and Structures
208
5.5 Introduction to the Debugger
210
5.6 Practice
215
5.7 Summary
215
6 User Interaction
217
6.1 Selection Screen Overview
218
6.1.1 PARAMETERS
219
6.1.2 SELECT-OPTIONS
226
6.1.3 SELECTION-SCREEN
234
6.1.4 Selection Texts
235
6.2 Messages
236
6.2.1 Types of Messages
237
6.2.2 Messages Using Text Symbols
238
6.2.3 Messages Using Message Classes
240
6.2.4 Dynamic Messages
242
6.2.5 Translation
243
6.3 Summary
244
7 Modularization Techniques
245
7.1 Modularization Overview
246
7.2 Program Structure
249
7.2.1 Processing Blocks
250
7.2.2 Event Blocks
263
7.2.3 Dialog Modules
264
7.2.4 Procedures
266
7.3 Events
266
7.3.1 Program Constructor Events
266
7.3.2 Reporting Events
267
7.3.3 Selection Screen Events
273
7.3.4 List Events
274
7.3.5 Screen Events
275
7.4 Procedures
276
7.4.1 Subroutines
279
7.4.2 Function Modules
288
7.4.3 Methods
297
7.5 Inline Declarations
304
7.5.1 Assigning Values to Data Objects
304
7.5.2 Using Inline Declarations with Table Work Areas
305
7.5.3 Avoiding Helper Variables
305
7.5.4 Declaring Actual Parameters
306
7.6 Summary
307
8 Object-Oriented ABAP
309
8.1 Procedural Programming versus Object-Oriented Programming
309
8.2 Principles of Object-Oriented Programming
313
8.2.1 Attributes
315
8.2.2 Static and Instance Components
316
8.2.3 Methods
317
8.2.4 Objects
319
8.2.5 Constructor
321
8.3 Encapsulation
322
8.3.1 Component Visibility
323
8.3.2 Friends
325
8.3.3 Implementation Hiding
326
8.4 Inheritance
329
8.4.1 Defining Inheritance
330
8.4.2 Abstract Classes and Methods
334
8.4.3 Final Classes and Methods
337
8.4.4 Composition
339
8.4.5 Refactoring Assistant
340
8.5 Polymorphism
341
8.5.1 Static and Dynamic Types
341
8.5.2 Casting
343
8.5.3 Dynamic Binding with the Call Method
348
8.5.4 Interfaces
350
8.5.5 Events
357
8.6 Working with the Extensible Markup Language
360
8.6.1 XML Overview
361
8.6.2 XML Processing Concepts
362
8.7 Summary
365
9 Exception Handling
367
9.1 Exceptions Overview
367
9.2 Procedural Exception Handling
368
9.2.1 Maintaining Exceptions Using Function Modules
368
9.2.2 Maintaining Exceptions Using Methods
370
9.2.3 Maintaining Exceptions for Local Classes
371
9.3 Class-Based Exception Handling
372
9.3.1 Raising Exceptions
374
9.3.2 Catchable and Noncatchable Exceptions
375
9.3.3 Defining Exception Classes Globally
380
9.3.4 Defining Exception Classes Locally
383
9.4 Messages in Exception Classes
383
9.4.1 Using the Online Text Repository
383
9.4.2 Using Messages from a Message Class
387
9.4.3 Using the MESSAGE Addition to Raise an Exception
389
9.5 Summary
390
10 ABAP Data Dictionary
391
10.1 Database Tables
392
10.1.1 Creating a Database Table
395
10.1.2 Indexes
405
10.1.3 Table Maintenance Generator
409
10.1.4 Foreign Keys
414
10.1.5 Include Structure
417
10.1.6 Append Structure
419
10.2 Views
421
10.2.1 Database Views
422
10.2.2 Projection Views
424
10.2.3 Maintenance Views
425
10.2.4 Help Views
428
10.2.5 ABAP Core Data Services Views
428
10.3 Data Types
433
10.3.1 Data Elements
433
10.3.2 Structures
437
10.3.3 Table Types
440
10.4 Type Groups
444
10.5 Domains
445
10.6 Search Helps
448
10.6.1 Elementary Search Helps
450
10.6.2 Collective Search Helps
454
10.6.3 Assigning a Search Help
456
10.6.4 Search Help Exits
457
10.7 Lock Objects
458
10.8 Summary
462
11 Persistent Data
463
11.1 Working with Data in Databases
464
11.1.1 Open SQL
465
11.1.2 Logical Unit of Work
476
11.2 ABAP Object Services
483
11.2.1 Persistence Service Overview
483
11.2.2 Building Persistent Classes
484
11.2.3 Working with Persistent Objects
488
11.3 File Interfaces
489
11.3.1 Working with Files in the Application Server
489
11.3.2 Working with Files in the Presentation Layer
492
11.4 Data Clusters
494
11.4.1 Exporting Data Clusters to Databases
496
11.4.2 Importing Data Clusters
496
11.5 Security Concepts
496
11.6 Summary
498
12 Dialog Programming
501
12.1 Screen Events
502
12.2 Screen Elements and Flow Logic
505
12.2.1 Components of a Dialog Program
507
12.2.2 Screens
511
12.2.3 Screen Elements
516
12.3 Basic Screen Elements
520
12.3.1 Text Fields
521
12.3.2 Checkboxes and Radio Buttons
522
12.3.3 Push Buttons
524
12.4 Input/Output Fields
525
12.5 List Box
527
12.6 Table Controls
528
12.6.1 Create a Table Control without a Wizard
529
12.6.2 Create a Table Control with a Wizard
534
12.7 Tabstrip Controls
535
12.8 Subscreens
537
12.9 Working with Screens
538
12.9.1 Screen Flow Logic
539
12.9.2 GUI Status
541
12.9.3 GUI Title
543
12.9.4 Modifying Screen Fields Dynamically
544
12.9.5 Field Help and Input Help
546
12.9.6 Screen Sequence
547
12.9.7 Assigning Transaction Codes
549
12.10 Control Framework
551
12.10.1 Using Container Controls
552
12.10.2 Implementing Custom Controls
553
12.11 Practice
555
12.11.1 Application Flow
557
12.11.2 Delete Functionality
559
12.11.3 Validations and Autofills
559
12.12 Summary
560
13 List Screens
561
13.1 Program Types
562
13.1.1 Executable Programs
562
13.1.2 Module Pool Programs
564
13.1.3 Function Groups
564
13.1.4 Class Pools
565
13.1.5 Interface Pools
565
13.1.6 Subroutine Pools
565
13.1.7 Type Pools
565
13.1.8 Include Programs
566
13.2 Program Execution
566
13.2.1 Executable Program Flow
567
13.2.2 Module Pool Program Flow
568
13.2.3 Calling Programs Internally
569
13.3 Memory Organization
569
13.4 List Events
574
13.4.1 TOP-OF-PAGE
574
13.4.2 END-OF-PAGE
576
13.4.3 AT LINE-SELECTION
577
13.4.4 AT USER-COMMAND
578
13.5 Basic Lists and Detail Lists
579
13.6 Classical Reports
584
13.7 Interactive Reports
584
13.7.1 HIDE
584
13.7.2 READ LINE
589
13.7.3 GET CURSOR
589
13.7.4 DESCRIBE LIST
589
13.8 Practice
590
13.9 Summary
592
14 Selection Screens
593
14.1 Defining Selection Screens
594
14.2 Selection Screen Events
596
14.3 Input Validations
598
14.4 Selection Screen Variants
600
14.4.1 Creating a Variant
601
14.4.2 Variant Attributes
605
14.4.3 Table Variables from Table TVARVC
605
14.4.4 Dynamic Date Calculation
608
14.4.5 Dynamic Time Calculation
609
14.4.6 User-Specific Variables
609
14.5 Executing Programs in the Background
610
14.6 Displaying and Hiding Screen Elements Dynamically
612
14.7 Calling Programs via Selection Screens
615
14.8 Summary
615
15 SAP List Viewer Reports
617
15.1 Standard ALV Reports Using the Reuse Library
618
15.1.1 List and Grid Display: Simple Reports
619
15.1.2 Block Display
629
15.1.3 Hierarchical Sequential Display
632
15.2 Interactive Reports
637
15.2.1 Loading a Custom SAP GUI Status
638
15.2.2 Reacting to User Actions
642
15.2.3 Printing TOP-OF-PAGE
643
15.3 ALV Reports Using the Control Framework
644
15.4 ALV Object Model
647
15.4.1 Table Display
648
15.4.2 Hierarchical Display
650
15.4.3 Tree Object Model
653
15.5 Summary
656
16 Dynamic Programming
657
16.1 Field Symbols
659
16.1.1 Using Field Symbols to Make Programs Dynamic
660
16.1.2 Defining Field Symbols
667
16.1.3 Assigning a Data Object
669
16.1.4 Checking If a Field Symbol Is Assigned
672
16.1.5 Unassigning a Field Symbol
672
16.1.6 Casting
673
16.2 Data References
674
16.2.1 Defining Reference Variables
674
16.2.2 Getting Data References
675
16.2.3 Anonymous Data Objects
677
16.2.4 Assignment between Reference Variables
678
16.3 Runtime Type Services
680
16.3.1 Runtime Type Information
681
16.3.2 Runtime Type Creation
682
16.4 Dynamic Token Specification
685
16.5 Dynamic Procedure Calls
687
16.6 Dynamic Program Generation
690
16.7 Summary
692
17 Debugging
693
17.1 Classic Debugger
694
17.1.1 Activating and Using the Classic Debugger
695
17.1.2 Field View
699
17.1.3 Table View
699
17.1.4 Breakpoints View
700
17.1.5 Watchpoints View
700
17.1.6 Calls View
702
17.1.7 Overview View
702
17.1.8 Settings View
703
17.1.9 Additional Features
703
17.2 New Debugger
707
17.2.1 User Interface and Tools
707
17.2.2 Layout and Sessions
710
17.3 ABAP Managed Database Procedures Debugger
712
17.4 Using the Debugger to Troubleshoot
712
17.5 Using the Debugger as a Learning Tool
714
17.6 Summary
715
18 Forms
717
18.1 SAP Scripts
719
18.1.1 Overview and Layout
719
18.1.2 Creating the Form Layout
723
18.1.3 Maintaining Window Details
729
18.1.4 Processing Forms with Function Modules
734
18.2 Smart Forms
742
18.2.1 Overview and Layout
742
18.2.2 Maintaining the Global Settings
745
18.2.3 Maintaining Elements
748
18.2.4 Driver Program
764
18.3 SAP Interactive Forms by Adobe
767
18.3.1 Form Interface
768
18.3.2 Form Context and Layout
774
18.3.3 Driver Program
786
18.3.4 Downloading the Form as a PDF
787
18.4 Summary
789
19 Interfaces
791
19.1 Batch Data Communication
792
19.1.1 Direct Input
794
19.1.2 Batch Input
795
19.2 Business Application Programming Interfaces
806
19.2.1 Business Object Types and Business Components
807
19.2.2 BAPI Development via BAPI Explorer
807
19.2.3 Standardized Business Application Programming Interfaces
810
19.2.4 Standardized Parameters
811
19.2.5 Implementing Business Application Programming Interfaces
813
19.3 EDI/ALE/IDocs
822
19.3.1 Electronic Data Interchange
822
19.3.2 Application Link Enabling
827
19.3.3 Intermediate Documents
830
19.3.4 System Configurations
841
19.3.5 Inbound/Outbound Programs
848
19.4 Legacy System Migration Workbench
852
19.4.1 Getting Started
852
19.4.2 Migration Process Steps
853
19.5 Web Services
864
19.5.1 Creating a Web Service
867
19.5.2 Consuming Web Services
871
19.6 Open Data Protocol Services
878
19.6.1 Data Model Definition
880
19.6.2 Service Maintenance
884
19.6.3 Service Implementation
886
19.6.4 READ
888
19.7 Extensible Stylesheet Language Transformations
891
19.7.1 Serialization
892
19.7.2 Deserialization
892
19.8 XML and JSON Data Representation
894
19.9 WebSockets (ABAP Channels and Messages)
896
19.9.1 Creating an ABAP Messaging Channel
897
19.9.2 Creating a Producer Program
899
19.9.3 Creating a Consumer Program
900
19.10 Summary
903
20 Modifications and Enhancements
905
20.1 Customization Overview
905
20.2 Modification Overview
907
20.3 Using the Modification Assistant
908
20.3.1 Modifications to Programs
909
20.3.2 Modifications to the Class Builder
910
20.3.3 Modifications to the Screen Painter
911
20.3.4 Modifications to the Menu Painter
912
20.3.5 Modifications to the ABAP Data Dictionary
913
20.3.6 Modifications to Function Modules
913
20.3.7 Resetting to Original
914
20.4 Using the Modification Browser
915
20.5 Enhancements Overview
916
20.6 User Exits
918
20.7 Customer Exits
919
20.7.1 Create a Customer Exit
921
20.7.2 Function Module Exits
924
20.7.3 Screen Exits
924
20.7.4 Menu Exits
926
20.8 Business Add-Ins
928
20.8.1 Overview
928
20.8.2 Defining a BAdI
930
20.8.3 Implementing a Business Add-In
937
20.8.4 Implementing a Fallback Class
939
20.8.5 Calling a Business Add-In
940
20.9 Enhancement Points
941
20.9.1 Explicit Enhancements
941
20.9.2 Implicit Enhancements
944
20.10 Business Transaction Events
947
20.10.1 Implementing a Business Transaction Event
948
20.10.2 Testing a Custom Function Module
951
20.11 Summary
952
21 Test and Analysis Tools
955
21.1 Overview of Tools
956
21.2 ABAP Unit
958
21.2.1 Eliminating Dependencies
959
21.2.2 Implementing Mock Objects
961
21.2.3 Writing and Implementing Unit Tests
961
21.3 Code Inspector
969
21.4 Selectivity Analysis
972
21.5 Process Analysis
974
21.6 Memory Inspector
976
21.6.1 Creating Memory Snapshots
977
21.6.2 Comparing Memory Snapshots
978
21.7 Table Call Statistics
979
21.8 Performance Trace
981
21.8.1 Activating and Filtering a Performance Trace
983
21.9 ABAP Trace/Runtime Analysis
989
21.9.1 Running ABAP Trace
990
21.9.2 Analyzing the Results
992
21.10 Single-Transaction Analysis
994
21.11 Dump Analysis
997
21.12 Summary
999
The Author
1001
Index
1003