PART I ABAP/4 BASICS
Chapter 1 Data Types and Definitions
In This Chapter
Building ABAP/4 Statements
Commenting Your Code
Improving Statement Readability with the Colon Notation
Defining Programs (REPORT)
Using Variables
Variable Data Types
Defining Variables (DATA)
Grouping Variables into Records
Defining New Data Types (TYPES)
Defining Constant Data Elements (CONSTANTS)
Using Runtime Parameters
Using Field Symbols
Assigning Values to Variables
Using MOVE to Assign Variables
Data Type Conversion During Assignments
Summary
Chapter 2 Displaying and Printing Data
In This Chapter
Setting Up the Page (REPORT)
General Features of the WRITE Statement
Outputting Plain Text
Outputting Field Names (Variables)
Outputting Groups of Text and Data Fields
Formatting the Output
Column Positioning
Dynamic Positioning and Output
Breaking to a New Line (Inserting Carriage Returns)
Controlling the Output Length
Default Data Alignment
Using Text Elements
Advanced Features of the WRITE Statement
Masking the Output (USING EDIT MASK and USING NO EDIT MASK)
Suppressing Blanks (NO-ZERO)
Suppressing Number (+/-) Signs (NO-SIGN)
Choosing a Date Format
Displaying Currency (CURRENCY)
Aligning Fields Vertically (UNDER)
Closing Gaps Between Fields (NO-GAP)
Specifying Decimal Places (DECIMALS)
Specifying Justification (LEFT-JUSTIFIED, CENTERED, RIGHT-JUSTIFIED)
Transferring Data with a Specified Format (WRITE... TO)
Inserting Horizontal Lines (ULINE)
Inserting Blank Lines (SKIP)
Controlling Horizontal Positioning (POSITION)
Displaying Messages (MESSAGE)
Using the FORMAT Command
Boldfacing (INTENSIFIED)
Changing Colors (COLOR)
Reversing the Text (INVERSE)
Restoring the Default Settings (RESET)
Summary
Chapter 3 Manipulating Data
In This Chapter
Working with Numeric Data
Performing Math (COMPUTE)
Controlling Precision in Expressions
Alternatives to COMPUTE (ADD, SUBTRACT, MULTIPLY, and DIVIDE)
Adding Sequential Fields (ADD)
Using the CORRESPONDING Commands
Manipulating Character Data
Defining Substrings with Offsets
Using Variable Offsets to Define Substrings
Using Other Text-Processing Commands
Shifting Characters Right or Left (SHIFT)
Changing the Capitalization (TRANSLATE)
Replacing Individual Characters (OVERLAY)
Replacing Multiple Characters (REPLACE)
Searching for Characters (SEARCH)
Dividing Strings (SPLIT)
Merging Strings (CONCATENATE)
Removing Spaces (CONDENSE)
Working with Date Variables
Using Time Variables
Manipulating Field Symbols
Assigning a Variable to a Field Symbol (ASSIGN)
Summary
Chapter 4 Using Conditional Operators
In This Chapter
Using the CASE Statement
Using IF with Logical Operators
Using Comparison Operators
Comparing Non-Numeric Values
Using Equal/Not Equal Operators
Determining Whether Values Have Changed (IS INITIAL)
Determining Whether a Value Is Included in a Range (IS BETWEEN)
Using the NOT Operator
Comparing Character Fields (CO, CA, CS, and CP)
CO (Contains Only)
CA (Contains Any)
CS (Contains String)
CP (Contains Pattern)
Nesting Statements
Summary
Chapter 5 Using the Looping Commands
In This Chapter
Using the DO Loop Command
Exiting the Loop
When to Use DO Loops
Nesting DO Loops
Using the WHILE Loop
Nesting WHILE Loops
Using the LOOP Statement
When to Use the LOOP Command
Looping Selectively Through Internal Tables
Summary
Chapter 6 Working with Internal Tables
In This Chapter
Understanding the Structure of an Internal Table
Defining a Table
Determining the Number of Records
Using Field Strings
Including Structures
Manipulating Data in Tables
Moving Data into a Table
Modifying Records (READ and MODIFY)
Deleting Records (DELETE)
Collecting Records (COLLECT)
Clearing the Structure Record (CLEAR)
Refreshing a Table (REFRESH)
Reading Internal Tables
Using INDEX with READ
Using the WITH KEY Addition with READ
Conducting Binary Searches
Using Other Table Commands
Determining Table Properties (DESCRIBE)
Sorting Records with the SORT Command
Looping with LOOP AT and LOOP AT WHERE
Using ON CHANGE OF Inside a Loop
Summary
Chapter 7 Working with the Data Dictionary
In This Chapter
Data and Structure Definitions
Tables
Organizing Your Data
Domains
Data Elements
Fields
Data Dictionary Tools
General Table Display (se16 and se17)
Displaying Fields, Data Elements, and Domains (se15)
Summary
PART II ACCESSING THE DATABASE
Chapter 8 Using SAP SQL to Access Database Tables
In This Chapter
Using SQL to Access Tables and Views
Using SQL with Transactions
Reading Data from the Database (SELECT)
Using WHERE to Limit the Data Returned with SELECT
Using Operators with WHERE
Using AND and OR with WHERE
Using NOT with WHERE
WHERE Clause Examples
Options for the SELECT Command
Inserting Records Into an Internal Table (INTO TABLE)
Appending Selected Records to a Table (APPENDING TABLE)
Selecting a Single Row (SELECT SINGLE)
Using ORDER BY to Sort Data
SELECT Examples
Updating Tables (UPDATE)
Using SET with UPDATE
Using the FROM TABLE Option with UPDATE
Inserting Data (INSERT)
Inserting Explicit Data
Inserting Data with FROM TABLE
Deleting Rows (DELETE)
Using WHERE with DELETE
Deleting Multiple Rows with FROM TABLE
Learning Advanced Techniques
Using Explicit Field Lists
Using Aggregate Functions to Process Data
Using GROUP BY to Subtotal Data
Using INNER JOIN to Access Multiple Tables
Summary
Chapter 9 Working with External Files
In This Chapter
Data Mapping
Establishing the Path and File Name
Opening the File (OPEN DATASET)
Marking a File for Output (FOR OUTPUT)
Marking a File for Input (FOR INPUT)
Selecting a Transfer Mode (IN TEXT MODE/IN BINARY MODE)
Writing to the End of a File (FOR APPENDING)
Indicating the Start of the Read (AT POSITION)
Adding a System Message (MESSAGE)
Sending a Command to the Server (FILTER)
Writing the Data to the Server (TRANSFER)
Reading the Data from the Data File (READ)
Closing the File (CLOSE DATASET)
Summary
Chapter 10 Advanced Data Outputs
In This Chapter
Processing Events in ABAP/4
Setting Initial Values (INITIALIZATION)
Using the START-OF-SELECTION and END-OF-SELECTION Markers
Triggering Code with an AT Event
Using Field Groups as an Alternative to Internal Tables
Defining Field Groups
Extracting Data
Sorting the Records (SORT)
Copying Records to Fields with LOOP
Triggering an Event with a New Value (AT field-group)
Summary
Chapter 11 Adding Subroutines to Your Program
In This Chapter
Executing Subroutines (PERFORM)
The TABLES, USING, and CHANGING Parameters
Defining Subroutines (FORM)
Using Parameters to Pass Data
Indicating the Structure of the Incoming Parameter (STRUCTURE)
Understanding the Scope of Local and Global Variables
Persistent Local Variables (STATICS)
Looking at Form Examples
Summary
Chapter 12 Using Function Modules and BAPIs
In This Chapter
Using the Function Modules Screen
Searching for a Specific Function Module
Testing Individual Function Modules
Creating a Custom Function Module
Defining Input/Output Parameters
Developing the ABAP Code
Defining Tables and Handling Errors
Activating the Function Module
Using Function Modules in ABAP Code
Processing Input/Output Parameters
Defining Errors Encountered in Function Calls
Some Useful Function Modules
Summary
Chapter 13 Working with Logical Databases
In This Chapter
Advantages of Logical Databases
Using the GET Event to Retrieve Data
Using GET LATE
Limiting Data with Logical Database Parameters
Summary
PART III COMMON ABAP PROGRAMS
Chapter 14 Writing a Report
In This Chapter
Determining the Functional Specifications
Selecting Data
Choosing the Right Tables (Verifying the Functional Spec)
Determining the Order of Data Selection
Field Groups versus Internal Tables
Specifying the Data Types
Data Selection
Creating Organized Output
Setting Up Titles and Headers
Printing the Report
Viewing the Complete Program
Summary
Chapter 15 Web Dynpro
In This Chapter
Architecture of Web Dynpro
Web Dynpro Component
Interface Controller
Web Dynpro Application
Web Dynpro Application URL
Building a Simple Application
Testing Your Web Dynpro Component
Summary
Chapter 16 Writing a Data Extract
In This Chapter
Steps in a Data Extract
Determining the Data to Be Extracted
Extracting the Data
Writing the Data to a File
Transferring the File to the Target System
Example Extracts
Check Payments
Purchase Orders
Inventory Changes
Summary
Chapter 17 Writing a BDC Program
In This Chapter
Understanding the Steps in a BDC
Identifying Screens in a Transaction
Building the BDC Table
Submitting the BDC Table
Example BDC Sessions
A BDC Program to Change a Vendor’s Address
Comparing Different Processing Techniques
A BDC Program to Create Project-Planning Data
Summary
Chapter 18 Working with SAP Security and Authorizations
In This Chapter
The SAP Security Model
The Authorization Object
Authorization Fields
Creating Authorization Objects
Using the AUTHORITY-CHECK Command
Summary
PART IV ADVANCED TECHNICAL ISSUES
Chapter 19 ABAP Workbench (Debugger)
In This Chapter
The ABAP Debugger
Entering Debug Mode
Defining the Debugger’s Screen
General Commands
The Return Command
The Primary Screen
Using Watchpoints
Internal Tables
More About Breakpoints
Tips and Techniques for Debugging
Summary
Chapter 20 Performance Analysis and Tuning
In This Chapter
Using SELECT *
Using the Primary Key
Using CHECK Statements
Using Tables
Cluster Tables versus Transparent Tables
Avoid Tables with Many Records
Selecting into Tables
Using the MOVE Statement
Looping
Using WHILE
Using DO
Using LOOP
Choosing Internal Tables versus Field Groups
Working with Logical Databases
Reading Specific Tables
Optimizing with Obligatory Fields
Using Batching versus Online Programs
Summary
Chapter 21 Web Services
In This Chapter
Creating and Publishing a Web Service in SAP
Creating a SOAP Web Service
Creating a REST Web Service
Summary
Chapter 22 BADIs and User Exits
In This Chapter
Understanding BADIs
Using Filters
Creating a BADI Implementation
Finding a BADI
Useful BADIs
Understanding User Exits
Finding User Exits
Summary
Chapter 23 Object Oriented ABAP
In This Chapter
Object Oriented ABAP Basics
Classes
ABAP Class Structure
Visibility Concepts
Public Section
Protected Section
Private Section
Handling ABAP Objects
Object Reference Variables
Data Types for References
Creating Objects
Addressing the Components of Objects
Declaring Methods
Implementing Methods
Static Method Call
Constructors
SAP Tools Example: Creating a Sample Class and Method
Extra Help
Sample ABAP Program Using Object Oriented Concepts
Summary
Chapter 24 One Order Model for CRM ABAP Programming
In This Chapter
Introduction to Table Structure in CRM
Understanding the One Order Framework
Understanding GUID
Looking at Some Example Transactions
Function Modules Used
Debugging and Finding the Data You Need
Using BADIs
Summary
PART V ABAP APPENDIXES
Appendix A Using the ABAP Editor
Getting to Know the Editor
Editing Programs
Appendix B SAP System Fields
Appendix C ABAP ERP and CRM Tables
Index