Table of Contents

Open all
Close all
Acknowledgments
21
Preface
23
Objective of This Book
23
Target Audience
23
Structure of This Book
24
1 Introduction to ERP and SAP
27
1.1 Historical Overview
27
1.2 Understanding an ERP System
30
1.2.1 What Is ERP?
30
1.2.2 ERP versus Non-ERP Systems
30
1.2.3 Advantages of an ERP System
32
1.3 Introduction to SAP
33
1.3.1 Modules in SAP
33
1.3.2 Types of Users
34
1.3.3 Role of an ABAP Consultant
35
1.3.4 Changing and Adapting the Data Structure
36
1.4 ABAP Overview
38
1.4.1 Types of Applications
39
1.4.2 RICEF Overview
39
1.5 System Requirements
42
1.6 Summary
43
2 Architecture of an SAP System
45
2.1 Introduction to the Three-Tier Architecture
45
2.2 SAP Implementation Overview
47
2.2.1 SAP GUI: Presentation Layer
47
2.2.2 Application Servers and Message Servers: Application Layer
49
2.2.3 Database Server/Relational Database Management System: Database Layer
55
2.2.4 SAP HANA Introduction
57
2.3 Data Structures
60
2.3.1 Client Overview
61
2.3.2 Client-Specific Data and Cross-Client Data
61
2.3.3 Repository
64
2.3.4 Packages
64
2.3.5 Transport Organizer
65
2.4 Summary
70
3 Introduction to the ABAP Environment
71
3.1 SAP Environment
71
3.1.1 ABAP Programming Environment
72
3.1.2 Logging On to the SAP Environment
72
3.1.3 Elements of the SAP Screen
73
3.1.4 Transaction Codes
75
3.1.5 Opening and Navigating with Transactions
76
3.2 ABAP Workbench Overview
80
3.2.1 ABAP Editor
80
3.2.2 Function Builder
82
3.2.3 Class Builder
83
3.2.4 Screen Painter
83
3.2.5 Menu Painter
85
3.2.6 ABAP Data Dictionary
86
3.2.7 Object Navigator
88
3.3 Eclipse IDE Overview
89
3.4 SAP Business Technology Platform, ABAP Environment
94
3.5 Summary
95
4 ABAP Programming Concepts
97
4.1 General Program Structure
98
4.1.1 Global Declarations
98
4.1.2 Procedural Area
99
4.2 ABAP Syntax
99
4.2.1 Basic Syntax Rules
100
4.2.2 Chained Statements
101
4.2.3 Comment Lines
102
4.3 ABAP Keywords
102
4.4 Introduction to the TYPE Concept
103
4.4.1 Data Types
104
4.4.2 Data Elements
117
4.4.3 Domains
120
4.4.4 Data Objects
123
4.5 ABAP Statements
126
4.6 Creating Your First ABAP Program
128
4.7 Summary
133
5 Structures and Internal Tables
135
5.1 Defining Structures
136
5.1.1 When to Define Structures
138
5.1.2 Local Structures
138
5.1.3 Global Structures
141
5.1.4 Working with Structures
144
5.1.5 Use Cases
145
5.2 Internal Tables
146
5.2.1 Defining Internal Tables
146
5.2.2 Types of Internal Tables
149
5.2.3 Table Keys
152
5.2.4 Working with Internal Tables
156
5.2.5 Control Break Statements
162
5.3 Introduction to Open SQL Statements
167
5.3.1 Database Overview
168
5.3.2 Selecting Data from Database Tables
176
5.3.3 Selecting Data from Multiple Tables
178
5.4 Processing Data from Databases via Internal Tables and Structures
181
5.5 Introduction to the Debugger
183
5.6 Practice
186
5.7 Summary
186
6 User Interaction
187
6.1 Selection Screen Overview
187
6.1.1 PARAMETERS
189
6.1.2 SELECT-OPTIONS
195
6.1.3 SELECTION-SCREEN
202
6.1.4 Selection Texts
203
6.2 Messages
204
6.2.1 Types of Messages
205
6.2.2 Messages Using Text Symbols
206
6.2.3 Messages Using Message Classes
207
6.2.4 Dynamic Messages
209
6.2.5 Translation
210
6.3 Summary
211
7 Modularization Techniques
213
7.1 Modularization Overview
213
7.2 Program Structure
217
7.2.1 Processing Blocks
217
7.2.2 Event Blocks
229
7.2.3 Dialog Modules
230
7.2.4 Procedures
231
7.3 Events
231
7.3.1 Program Constructor Events
231
7.3.2 Reporting Events
232
7.3.3 Selection Screen Events
238
7.3.4 List Events
238
7.3.5 Screen Events
239
7.4 Procedures
240
7.4.1 Subroutines
242
7.4.2 Function Modules
250
7.4.3 Methods
258
7.5 Inline Declarations
264
7.5.1 Assigning Values to Data Objects
264
7.5.2 Using Inline Declarations with Table Work Areas
265
7.5.3 Avoiding Helper Variables
265
7.5.4 Declaring Actual Parameters
265
7.6 Summary
266
8 Object-Oriented ABAP
267
8.1 Procedural Programming versus Object-Oriented Programming
267
8.2 Principles of Object-Oriented Programming
271
8.2.1 Attributes
273
8.2.2 Static and Instance Components
274
8.2.3 Methods
274
8.2.4 Objects
277
8.2.5 Constructor
278
8.3 Encapsulation
279
8.3.1 Component Visibility
280
8.3.2 Friends
282
8.3.3 Implementation Hiding
283
8.4 Inheritance
286
8.4.1 Defining Inheritance
287
8.4.2 Abstract Classes and Methods
290
8.4.3 Final Classes and Methods
293
8.4.4 Composition
294
8.4.5 Refactoring Assistant
295
8.5 Polymorphism
296
8.5.1 Static and Dynamic Types
296
8.5.2 Casting
298
8.5.3 Dynamic Binding with the Call Method
302
8.5.4 Interfaces
304
8.5.5 Events
311
8.6 Working with the Extensible Markup Language
313
8.6.1 XML Overview
314
8.6.2 XML Processing Concepts
315
8.7 Summary
317
9 Exception Handling
319
9.1 Exceptions Overview
319
9.2 Procedural Exception Handling
320
9.2.1 Maintaining Exceptions Using Function Modules
320
9.2.2 Maintaining Exceptions Using Methods
322
9.2.3 Maintaining Exceptions for Local Classes
323
9.3 Class-Based Exception Handling
324
9.3.1 Raising Exceptions
325
9.3.2 Catchable and Noncatchable Exceptions
326
9.3.3 Defining Exception Classes Globally
330
9.3.4 Defining Exception Classes Locally
333
9.4 Messages in Exception Classes
333
9.4.1 Using the Online Text Repository
334
9.4.2 Using Messages from a Message Class
337
9.4.3 Using the MESSAGE Addition to Raise an Exception
339
9.5 Summary
339
10 ABAP Data Dictionary
341
10.1 Database Tables
342
10.1.1 Creating a Database Table
344
10.1.2 Indexes
353
10.1.3 Table Maintenance Generator
357
10.1.4 Foreign Keys
361
10.1.5 Include Structure
364
10.1.6 Append Structure
366
10.2 Views
367
10.2.1 Database Views
368
10.2.2 Projection Views
370
10.2.3 Maintenance Views
372
10.2.4 Help Views
374
10.2.5 ABAP Core Data Services Views
374
10.3 Data Types
378
10.3.1 Data Elements
378
10.3.2 Structures
382
10.3.3 Table Types
384
10.4 Type Groups
388
10.5 Domains
389
10.6 Search Helps
392
10.6.1 Elementary Search Helps
393
10.6.2 Collective Search Helps
396
10.6.3 Assigning a Search Help
399
10.6.4 Search Help Exits
400
10.7 Lock Objects
400
10.8 Summary
404
11 Persistent Data
405
11.1 Working with Data in Databases
406
11.1.1 Open SQL
407
11.1.2 Logical Unit of Work
417
11.2 ABAP Object Services
423
11.2.1 Persistence Service Overview
423
11.2.2 Building Persistent Classes
424
11.2.3 Working with Persistent Objects
427
11.3 File Interfaces
428
11.3.1 Working with Files in the Application Server
428
11.3.2 Working with Files in the Presentation Layer
431
11.4 Data Clusters
432
11.4.1 Exporting Data Clusters to Databases
434
11.4.2 Importing Data Clusters
434
11.5 Security Concepts
434
11.6 Summary
436
12 Dialog Programming
439
12.1 Screen Events
440
12.2 Screen Elements and Flow Logic
443
12.2.1 Components of a Dialog Program
444
12.2.2 Screens
448
12.2.3 Screen Elements
452
12.3 Basic Screen Elements
455
12.3.1 Text Fields
456
12.3.2 Checkboxes and Radio Buttons
457
12.3.3 Push Buttons
459
12.4 Input/Output Fields
460
12.5 List Box
461
12.6 Table Controls
462
12.6.1 Create a Table Control without a Wizard
463
12.6.2 Create a Table Control with a Wizard
467
12.7 Tabstrip Controls
468
12.8 Subscreens
470
12.9 Working with Screens
471
12.9.1 Screen Flow Logic
472
12.9.2 GUI Status
474
12.9.3 GUI Title
476
12.9.4 Modifying Screen Fields Dynamically
476
12.9.5 Field Help and Input Help
478
12.9.6 Screen Sequence
479
12.9.7 Assigning Transaction Codes
480
12.10 Control Framework
483
12.10.1 Using Container Controls
483
12.10.2 Implementing Custom Controls
484
12.11 Practice
486
12.11.1 Application Flow
487
12.11.2 Delete Functionality
488
12.11.3 Validations and Autofills
488
12.12 Summary
489
13 List Screens
491
13.1 Program Types
491
13.1.1 Executable Programs
492
13.1.2 Module Pool Programs
493
13.1.3 Function Groups
494
13.1.4 Class Pools
494
13.1.5 Interface Pools
494
13.1.6 Subroutine Pools
495
13.1.7 Type Pools
495
13.1.8 Include Programs
495
13.2 Program Execution
495
13.2.1 Executable Program Flow
496
13.2.2 Module Pool Program Flow
497
13.2.3 Calling Programs Internally
497
13.3 Memory Organization
498
13.4 List Events
502
13.4.1 TOP-OF-PAGE
502
13.4.2 END-OF-PAGE
504
13.4.3 AT LINE-SELECTION
505
13.4.4 AT USER-COMMAND
506
13.5 Basic Lists and Detail Lists
507
13.6 Classical Reports
511
13.7 Interactive Reports
511
13.7.1 HIDE
511
13.7.2 READ LINE
515
13.7.3 GET CURSOR
515
13.7.4 DESCRIBE LIST
516
13.8 Practice
516
13.9 Summary
517
14 Selection Screens
519
14.1 Defining Selection Screens
520
14.2 Selection Screen Events
521
14.3 Input Validations
523
14.4 Selection Screen Variants
525
14.4.1 Creating a Variant
526
14.4.2 Variant Attributes
529
14.4.3 Table Variables from Table TVARVC
530
14.4.4 Dynamic Date Calculation
532
14.4.5 Dynamic Time Calculation
533
14.4.6 User-Specific Variables
534
14.5 Executing Programs in the Background
534
14.6 Displaying and Hiding Screen Elements Dynamically
536
14.7 Calling Programs via Selection Screens
538
14.8 Summary
538
15 SAP List Viewer Reports
541
15.1 Standard ALV Reports Using the Reuse Library
542
15.1.1 List and Grid Display: Simple Reports
543
15.1.2 Block Display
551
15.1.3 Hierarchical Sequential Display
555
15.2 Interactive Reports
559
15.2.1 Loading a Custom GUI Status
560
15.2.2 Reacting to User Actions
564
15.2.3 Printing TOP-OF-PAGE
565
15.3 ALV Reports Using the Control Framework
566
15.4 ALV Object Model
568
15.4.1 Table Display
569
15.4.2 Hierarchical Display
570
15.4.3 Tree Object Model
574
15.5 SAP List Viewer with Integrated Data Access
576
15.6 Summary
578
16 Dynamic Programming
579
16.1 Field Symbols
580
16.1.1 Using Field Symbols to Make Programs Dynamic
582
16.1.2 Defining Field Symbols
588
16.1.3 Assigning a Data Object
589
16.1.4 Checking If a Field Symbol Is Assigned
592
16.1.5 Unassigning a Field Symbol
593
16.1.6 Casting
593
16.2 Data References
594
16.2.1 Defining Reference Variables
594
16.2.2 Getting Data References
595
16.2.3 Anonymous Data Objects
597
16.2.4 Assignment between Reference Variables
598
16.3 Runtime Type Services
599
16.3.1 Runtime Type Information
600
16.3.2 Runtime Type Creation
601
16.4 Dynamic Token Specification
604
16.5 Dynamic Procedure Calls
606
16.6 Dynamic Program Generation
608
16.7 Summary
610
17 Debugging
611
17.1 Classic Debugger
612
17.1.1 Activating and Using the Classic Debugger
612
17.1.2 Field View
616
17.1.3 Table View
616
17.1.4 Breakpoints View
617
17.1.5 Watchpoints View
617
17.1.6 Calls View
618
17.1.7 Overview View
619
17.1.8 Settings View
619
17.1.9 Additional Features
620
17.2 New Debugger
623
17.2.1 User Interface and Tools
623
17.2.2 Layout and Sessions
625
17.3 ABAP Managed Database Procedures Debugger
627
17.4 Using the Debugger to Troubleshoot
627
17.5 Using the Debugger as a Learning Tool
629
17.6 Summary
630
18 Forms
631
18.1 SAP Scripts
633
18.1.1 Overview and Layout
633
18.1.2 Creating the Form Layout
636
18.1.3 Maintaining Window Details
642
18.1.4 Processing Forms with Function Modules
647
18.2 Smart Forms
654
18.2.1 Overview and Layout
654
18.2.2 Maintaining the Global Settings
657
18.2.3 Maintaining Elements
659
18.2.4 Driver Program
674
18.3 SAP Interactive Forms by Adobe
677
18.3.1 Form Interface
678
18.3.2 Form Context and Layout
684
18.3.3 Driver Program
695
18.3.4 Downloading the Form as a PDF
696
18.4 Summary
697
19 Interfaces
699
19.1 Batch Data Communication
700
19.1.1 Direct Input
701
19.1.2 Batch Input
703
19.2 Business Application Programming Interfaces
713
19.2.1 Business Object Types and Business Components
713
19.2.2 BAPI Development via BAPI Explorer
714
19.2.3 Standardized Business Application Programming Interfaces
717
19.2.4 Standardized Parameters
718
19.2.5 Implementing Business Application Programming Interfaces
719
19.3 EDI/ALE/IDocs
727
19.3.1 Electronic Data Interchange
727
19.3.2 Application Link Enabling
732
19.3.3 Intermediate Documents
734
19.3.4 System Configurations
744
19.3.5 Inbound/Outbound Programs
751
19.4 Legacy System Migration Workbench
754
19.4.1 Getting Started
755
19.4.2 Migration Process Steps
756
19.5 Web Services
765
19.5.1 Creating a Web Service
767
19.5.2 Consuming Web Services
771
19.6 OData Services
777
19.6.1 Data Model Definition
779
19.6.2 Service Maintenance
782
19.6.3 Service Implementation
784
19.7 Extensible Stylesheet Language Transformations
788
19.7.1 Serialization
789
19.7.2 Deserialization
789
19.8 XML and JSON Data Representation
790
19.9 WebSockets (ABAP Channels and Messages)
792
19.9.1 Creating an ABAP Messaging Channel
793
19.9.2 Creating a Producer Program
795
19.9.3 Creating a Consumer Program
796
19.10 Summary
799
20 Modifications and Enhancements
801
20.1 Customization Overview
801
20.2 Modification Overview
803
20.3 Using the Modification Assistant
803
20.3.1 Modifications to Programs
804
20.3.2 Modifications to the Class Builder
805
20.3.3 Modifications to the Screen Painter
807
20.3.4 Modifications to the Menu Painter
808
20.3.5 Modifications to the ABAP Data Dictionary
808
20.3.6 Modifications to Function Modules
808
20.3.7 Resetting to Original
809
20.4 Using the Modification Browser
810
20.5 Enhancements Overview
811
20.6 User Exits
812
20.7 Customer Exits
813
20.7.1 Create a Customer Exit
816
20.7.2 Function Module Exits
818
20.7.3 Screen Exits
818
20.7.4 Menu Exits
820
20.8 Business Add-Ins
822
20.8.1 Overview
822
20.8.2 Defining a BAdI
823
20.8.3 Implementing a Business Add-In
830
20.8.4 Implementing a Fallback Class
832
20.8.5 Calling a Business Add-In
833
20.9 Enhancement Points
834
20.9.1 Explicit Enhancements
834
20.9.2 Implicit Enhancements
837
20.10 Business Transaction Events
840
20.10.1 Implementing a Business Transaction Event
841
20.10.2 Testing a Custom Function Module
844
20.11 Summary
845
21 Test and Analysis Tools
847
21.1 Overview of Tools
847
21.2 ABAP Unit
849
21.2.1 Eliminating Dependencies
850
21.2.2 Implementing Mock Objects
852
21.2.3 Writing and Implementing Unit Tests
853
21.3 Code Inspector
860
21.4 Selectivity Analysis
862
21.5 Process Analysis
864
21.6 Memory Inspector
866
21.6.1 Creating Memory Snapshots
867
21.6.2 Comparing Memory Snapshots
868
21.7 Table Call Statistics
869
21.8 Performance Trace
871
21.8.1 SQL Trace
874
21.8.2 Remote Function Call Trace
876
21.8.3 Enqueue Trace
877
21.8.4 Buffer Trace
878
21.9 ABAP Trace/Runtime Analysis
879
21.9.1 Running ABAP Trace
879
21.9.2 Analyzing the Results
881
21.10 Single-Transaction Analysis
883
21.11 Dump Analysis
886
21.12 Summary
887
The Author
889
Index
891