You are on page 1of 12

ABAP Programming (BC-ABA)

Introduction to ABAP
The ABAP Part of the Web Application Server
ABAP Personality
ABAP Application Server
Work Processes
Overview of the Components of Application Programs
Structure of an Application Program
Screens
What are ABAP Objects?
Checking Whether a Field Belongs to a Range
Checking Selection Criteria
Structure of ABAP Programs
Processing Blocks in ABAP Programs
ABAP Statements
Memory Structures of an ABAP Program
Checking for the Initial Value
Creating and Changing ABAP Programs
Opening Programs in the Object Navigator
Opening Programs in the ABAP Editor
Opening Programs Using Forward Navigation
Maintaining Program Attributes
Editing Programs
Program Checks
The ABAP Programming Language
ABAP Syntax
Syntax Conventions
Logical Databases and Contexts
Introductory Statements for Programs
Data Types and Data Objects
Data Types
Defining Data Types
Compatibility
Data Objects
Literals
Text Symbols
Variables
Constants
Interface Work Areas
Determining the Attributes of Data Objects
Examples of Data Types and Objects
Predefined ABAP Types
Data Types in the ABAP Dictionary
Predefined Data Objects
Replacing Field Contents
The LIKE Addition
The TYPE Addition
Splitting Character Strings
Finding the Length of a Character String
Local Data Types in Programs
Shifting Field Contents

1
Assigning Parts of Character Strings

Processing Data
Assigning Values
Assigning Values with MOVE
Resetting Values to Their Initial Value
Type Conversions
Conversion Rules for References
Conversion Rules for Structures
Conversion Rules for Internal Tables
Alignment of Data Objects
Numerical Operations
Arithmetic Calculations
Mathematical Functions
Business Calculations
Date and Time Calculations
Basic Statements
Logical Expressions
Comparisons Between Different Data Types
Comparing Strings
Comparing Bit Sequences
Checking Whether a Field Symbol is Assigned
Combining Several Logical Expressions
Controlling the Program Flow
Branching Conditionally
Loops
Handling Exceptions
Class-Based Exceptions
Overview of Class-Based Exceptions
Handling Exceptions
Raising Exceptions
Propagating Exceptions
Defining Exceptions
Exception Texts
Previous Concepts
Exceptions in Function Modules and Methods
Catchable Runtime Errors
Byte- und Zeichenkettenverarbeitung
Processing Character Strings
Creating a New Program Dynamically
Changing Existing Programs Dynamically
Creating and Starting Temporary Subroutines
Running Programs Created Dynamically
Concatenating Character Strings
Converting to Upper or Lower Case or Replacing Characters
Converting into a Sortable Format
Overlaying Character Fields
Condensing Field Contents
Finding Character Strings
Single Bit Processing in Hexadecimal Fields
Setting and Reading Bits
Bit Operations

2
Set Operations Using Bit Sequences
Processing Sections of Strings
Changing Table Lines Using the Index
Field Symbols and Data References
Field Symbols
Declaring Field Symbols
Assigning Data Objects to Field Symbols
Basic Forms of the ASSIGN Statement
Assigning Components of Structures to a Field Symbol
Casting Data Objects
Assigning Values with WRITE TO
Data Areas for Field Symbols
Data References
Reference Variables
Creating Data Objects Dynamically
Getting References to Data Objects
Dereferencing Data References
Data References: Example
Processing Large Volumes of Data
Internal tables
Creating Internal Tables
Internal table types
Internal table objects
Special Features of Standard Tables
Processing Internal Tables
Operations on Entire Internal Tables
Assigning Internal Tables
Initializing Internal Tables
Comparing Internal Tables
Sorting Internal Tables
Internal Tables as Interface Parameters
Determining the Attributes of Internal Tables
Operations on Individual Lines
Operations for Index Tables
Access Using Field Symbols
Inserting Lines Using the Index
Inserting Lines into Tables
Appending Summarized Lines
Appending Table Lines
Reading Lines of Tables
Binary Search in Standard Tables
Processing Table Entries in Loops
Changing Lines
Deleting Lines
Operations for all Table Types
Specifying the Index in Loops
Deleting Lines Using the Index
Finding Character Strings in Internal Tables
Using Header Lines as Work Areas
Extracts
Defining an Extract

3
Filling an Extract with Data
Processing Extracts
Reading an Extract
Sorting an Extract
Processing Control Levels
Calculating Numbers and Totals
Formatting Data
Example of Formatted Data
Formatting Data During Reading
Refining Data Using Internal Tables
Formatting Data Using Extracts
Saving Data Externally
ABAP Database Access
Accessing the Database in the R/3 System
Open SQL
Reading Data
Defining Selections
Specifying a Target Area
Specifying Database Tables
Selecting Lines
Grouping Lines
Selecting Groups of Lines
Specifying a Sort Order
Subqueries
Using a Cursor to Read Data
Locking Conflicts
Changing Data
Inserting Lines into Tables
Changing Lines
Deleting Lines
Inserting or Changing Lines
Committing Database Changes
Performance Notes
Keep the Result Set Small
Minimize the Amount of Data Transferred
Minimize the Number of Data Transfers
Minimize the Search Overhead
Reduce the Database Load
Native SQL
Native SQL for Oracle
Native SQL for Informix
Native SQL for DB2 Common Server
Working with Files
Working with Files on the Application Server
Automatic Checks in File Operations
Authorization Checks for Programs and Files
General Checks for File Access
Working with Files on the Presentation Server
Using Platform-Independent Filenames
Saving Data Objects as Clusters
Data Clusters in ABAP Memory
Data Clusters in the Database

4
Programming Database Updates
Transactions and Logical Units of Work
Database Logical Unit of Work (LUW)
SAP LUW
SAP Transactions
Checking Authorizations
Checking User Authorizations
Authorization Checks
The R/3 Lock Concept
Example Transaction: SAP Locking
Update Techniques
Asynchronous Update
Updating Asynchronously in Steps
Synchronous Update
Local Update
Creating Update Function Modules
Calling Update Functions
Calling Update Functions Directly
Adding Update-Task Calls to a Subroutine
Special LUW Considerations
Transactions That Call Update Function Modules
Dialog Modules that Call Update Function Modules
Error Handling for Bundled Updates
Obsolete Techniken
Using Contexts
What are Contexts?
The Context Builder in the ABAP Workbench
Creating and Editing a Context
Using Tables as Modules
Using Function Modules as Modules
Using Contexts as Modules
Testing a Context
Buffering Contexts
Fields
Modules
Interfaces
Using Contexts in ABAP Programs
Finding and Displaying a Context
Creating an Instance of a Context
Supplying Context Instances with Key Values
Querying Data from Context Instances
Message Handling in Contexts
Message Handling in Table Modules
Message Handling in Function Module Modules
Working With Contexts - Hints
Logical Databases
Structure of Logical Databases
Selection Views
Example of a Logical Database
Using Logical Databases
Linking a Logical DB to an Executable Program

5
Calling a Logical Database Using a Function Module
Editing Logical Databases
Creating a Logical Database
Processing the Structure
Editing a Search Help
Editing Selections
Editing the Database Program
Dynamic Selections in the Database Program
Field Selections in the Database Program
Search Helps in the Database Program
Independent Calls and the Database Program
Editing Other Components
Improving Performance
Lists
Creating Lists
Creating Simple Lists with the WRITE Statement
The WRITE Statement
Positioning WRITE Output on the List
Formatting Options
Displaying Symbols and Icons on the List
Blank Lines and Drawing Lines
Displaying Field Contents as Checkboxes
Using WRITE via a Statement Structure
Creating Complex Lists
The Standard List
Structure of the Standard List
GUI Status of the Standard List
The Self-Defined List
Individual Page Header
Determining the List Width
Creating Blank Lines
Determining the Page Length
Defining a Page Footer
Lists with Several Pages
Programming Page Breaks
Standard Page Headers of Individual Pages
Page length of individual pages
Page Width of List Levels
Scrolling in Lists
Scrolling Window by Window
Scrolling by Pages
Scrolling to the Margins of the List
Scrolling by Columns
Defining Where the User Can Scroll on a Page
Laying Out List Pages
Positioning the Output
Absolute Positioning
Relative Positioning
Formatting Output
The FORMAT Statement
Colors in Lists
Enabling Fields for Input
Outputting Fields as Hotspots
6
Special Output Formats
Lines in Lists
Interactive Lists
Detail Lists
Dialog Status for Lists
Context Menus for Lists
List Events in an ABAP Program
Lists in Dialog Boxes
Passing Data from Lists to Programs
Passing Data Automatically
Passing Data by Program Statements
Manipulating Detail Lists
Scrolling in Detail Lists
Setting the Cursor from within the Program
Modifying List Lines
Lists and Screens
Starting Lists from Screen Processing
Calling Screens from List Processing
Printing and Storing Lists
Printing a List after Creating it
Printing a List While Creating it
Print Parameters
Execute and Print
Printing from within the Program
Printing Lists from a Called Program
Print Control
Determining Left and Upper Margins
Determining the Print Format
Archiving Lists Using SAP ArchiveLink
ABAP User Dialogs
Screens
Screen Elements
Screen Attributes
Screen Elements
Screen fields
Screen Flow Logic
Processing Screens
User Actions on Screens
Processing Input/Output Fields
Pushbuttons on the Screen
Checkboxes and Radio Buttons with Function Codes
Using GUI Statuses
Reading Function Codes
Finding Out the Cursor Position
Calling ABAP Dialog Modules
Simple Module Calls
Controlling the Data Transfer
Calling Modules Unconditionally
Conditional Module Calls
Input Checks
Automatic Input Checks
Checking Fields in the Screen Flow Logic
7
Input Checks in Dialog Modules
Field Help, Input Help, and Dropdown Boxes
Field Help
Input Help
Input Help from the ABAP Dictionary
Input Help on the Screen
Input Help in Dialog Modules
Dropdown Boxes
Modifying Screens Dynamically
Setting Attributes Dynamically
The Field Selection Function
Setting the Cursor Position
Switching on Hold Data Dynamically
Screen Sequences
Static Next Screen
Dynamic Next Screen
Leaving a Screen from a Program
Starting a Screen Sequence
Calling Modal Dialog Boxes
Screen Sequences: Example Transaction
Filling an Initial Screen using SPA/GPA Parameters
Complex Screen Elements
Status Icons
Context Menus
Subscreens
Tabstrip Controls
Custom Controls
Table Controls
Using the LOOP Statement
Looping Through an Internal Table
Table Controls in ABAP Programs
Table Controls: Examples with Scrolling
Table Controls: Examples with Modifications
Appendix: The Step Loop Technique
Selection Screens
Selection Screens and Logical Databases
Defining Selection Screens
Defining Input Fields for Single Values
Basic Form of Parameters
Dynamic Dictionary Reference
Default Values for Parameters
SPA/GPA Parameters as Default Values
Allowing Parameters to Accept Upper and Lower Case
Reducing the Visible Length
Defining Required Fields
Search Helps for Parameters
Checking Input Values
Defining Checkboxes
Defining Radio Buttons
Hiding Input Fields
Modifying Input Fields
Defining Complex Selections

8
Selection tables
Basic Form of Selection Criteria
Selection Criteria and Logical Databases
Default Values for Selection Criteria
Restricting Entry to One Row
Restricting Entry to Single Fields
Additional Options for Selection Criteria
Formatting Selection Screens
Blank Lines, Underlines, and Comments
Several Elements in a Single Line
Blocks of Elements
Calling Selection Screens
Calling Standard Selection Screens
Calling User-Defined Selection Screens
User Actions on Selection Screens
Pushbuttons on the Selection Screen
Checkboxes and Radio Buttons with Function Codes
Pushbuttons in the Application Toolbar
Changing the Standard GUI Status
Selection Screen Processing
Basic Form
PBO of the Selection Screen
Processing Single Fields
Processing Blocks
Processing Radio Buttons
Processing Multiple Selections
Defining Field Help
Defining Input Help
Subscreens and Tabstrip Controls on Selection Screens
Selection Screens as Subscreens
Tabstrip Controls on Selection Screens
Subscreens on Selection Screens
Using Selection Criteria
Selection Tables in the WHERE Clause
Selection Tables in Logical Expressions
Selection Tables in GET Events
Messages
Message Management
Messages
Message Processing
Messages Without Screens
Messages on Screens
Messages on Selection Screens
Messages in Lists
Messages in Function Modules and Methods
Running ABAP Programs
Callable Units
ABAP Programs
Procedures
Screens and Screen Sequences
Calling Programs
External Program Calls

9
Calling Executable Programs
Filling the Selection Screen of a Called Program
Affecting Lists in Called Programs
Program Statements to Leave a Called Program
Running Programs Directly - Reports
Linking to a Logical Database
Event Blocks in Executable Programs
Description of Events
INITIALIZATION
AT SELECTION-SCREEN
START-OF-SELECTION
GET
GET … LATE
END-OF-SELECTION
Leaving Event Blocks
Leaving Event Blocks Using STOP
Leaving Event Blocks Using EXIT
Leaving Event Blocks Using CHECK
Leaving a GET Event Block Using REJECT
Dialog-Driven Programs: Transactions
Maintaining Transactions
Dialog Transactions
Report Transactions
OO Transaction
Variant Transactions
Parameter Transaction
Dialog Programs: Overview
Sample Transaction

Calling Transactions
Calling Screen Sequences as Modules
Passing Data Between Programs
Modularization Techniques
Defining Processing Blocks
Event blocks
Dialog modules
Procedures
Defining Subroutines
Global Data from the Main Program
Local Data in the Subroutine
The Parameter Interface
Function Modules
Function Groups
Creating Function Modules
Source Code Modules
Macros
Include Programs
Subroutines
Call Contexts
Internal Calls
External Procedure Calls

10
Organization of External Procedure Calls
Calling Subroutines
Naming Subroutines
Passing Parameters to Subroutines
Examples of Subroutines
Shared Data Areas
Terminating Subroutines
Calling Function Modules
ABAP Objects
What is Object Orientation?
From Function Groups to Objects
Example
Classes

Overview Graphic
Classes - Introductory Example
Object Handling
Overview Graphic
Objects - Introductory Example
Declaring and Calling Methods
Methods in ABAP Objects - Example
Inheritance
Inheritance: Overview Graphic
Inheritance: Introductory Example
Interfaces
Overview Graphics for Interfaces
Interfaces - Introductory Example
Triggering and Handling Events
Overview Graphic
Events: Introductory Example

Events in ABAP Objects - Example

Class Pools
OO Transactions

ABAP and Unicode


Character Codes
ABAP Development Under Unicode
Concepts and Conventions
Data Types
Data Layout of Structures
Unicode Fragment View
Valid Characters
Restrictions in Unicode Programs
Character-Type and Numeric Operands
Access Using Offset and Length Specifications
Assignments
Comparisons
Processing Strings
Type Checks and Type Compatibility
Changes to Database Operations
Determining the Length and Distance
11
Structure Enhancements
Other Changes
New ABAP Statements for Unicode
String Processing for Byte Strings
Determining the Length and Distance
Assignments to Field Symbols
Includes with Group Names
Creating Data Objects Dynamically
Assigning Fields Dynamically
Storing Data as Clusters
File interface
Files on the Presentation Server
Generic Types for Field Symbols and Parameters
Formatting Lists
New Classes for Unicode
Determining Field Properties
Converting Data
RFC and Unicode
Further Measures
Examples
Assignment Between Structures I
Assignment Between Structures II
Assignments Between Structures III
Assignments Between Structures IV
Assignment Between Structure and Single Field I
Assignment Between Structure and Single Field II
Assignment Between Structure and Single Field III
Assignment Between Structure and Single Field III
Assignment Between Structure and Single Field V
Character String Processing
File Interface
Outputting Lists
Unicode Glossary
Appendix
Programs, Screens, and Processing Blocks
ABAP System Fields

12