Contents
Introduction 11
1 The Basics of R/3 System Architecture 15
1.1 The
Application Server ....................................................................................
16
1.2 The Dialog
Process ...........................................................................................
18
1.3 The Update
Task ...............................................................................................
20
1.4 The
Enqueue Process .......................................................................................
21
1.5 The
Gateway Server .........................................................................................
23
1.6
Distributed Load Systems and the Message Server ..................................
26
1.7 The RFC
Interface Within the R/3 System ...................................................
28
2 The Basics of the ABAP Programming
Language 31
2.1 The ABAP
Development Environment ..........................................................
32
2.2 Creating
Database Tables ...............................................................................
36
2.2.1 The Data
Dictionary ..........................................................................
36
2.2.2
Relationships Between Domains, Data Elements, and Tables .....
37
2.2.3 Create a
Domain ................................................................................
38
2.2.4 Create a
Data Element ......................................................................
40
2.2.5 Create a
Transparent Table ...............................................................
41
2.2.6
Maintaining Data Records Using the Data Browser ......................
44
2.3 A Simple
Program ............................................................................................
44
2.4 ABAP Data
Types and Variable Declaration ................................................
48
2.5 Elementary
Programming Statements in ABAP ..........................................
52
2.5.1 Value
Assignments ............................................................................
52
2.5.2 Branches .............................................................................................
54
2.5.3 Loops ...................................................................................................
55
2.5.4 Access to
Internal Tables ..................................................................
56
2.5.5 Access to
Database Tables ................................................................
57
2.5.6
Configuration of Selection Screens .................................................
60
2.6 Creating
Function Modules ............................................................................
61
2.7 Coding Conventions in
This Book .................................................................
68
3 Introduction to Programming
with the RFC API 71
3.1 The Task
for the First Example .......................................................................
72
3.2
Programming the SAP Function Modules ....................................................
73
3.3
Programming the Client ..................................................................................
75
3.3.1 The
Configuration of the main() Function ......................................
76
3.3.2 Open a
Connection to the R/3 System ...........................................
79
3.3.3 Calling
Up Function Modules in the R/3 System ..........................
85
3.4 Frequent
Errors on the Client Side ................................................................
91
3.5 Overview
of the Functions and Structures Used ........................................
93
3.6 From an
RFC Function Call to the Function Module .................................
93
3.7
Programming the External Server ..................................................................
96
3.7.1
Configuring the main() Function for an External Server ...............
97
3.7.2 Open a
Connection with the R/3 System .......................................
99
3.7.3
Implementing the Message Loop ....................................................
103
3.7.4
Implementing the Server Services ...................................................
104
3.7.5 Setting
Up the Connection to the R/3 System ..............................
111
3.7.6
Programming the ABAP Client .........................................................
114
3.8 Frequent
Errors on the Server Side ...............................................................
115
3.9 Functions
Used .................................................................................................
116
4 The Basics of RFC Programming 117
4.1 Type
Mapping and Data Aggregates ............................................................
117
4.1.1 Generic
Data Types ...........................................................................
117
4.1.2 The
Character Data Types .................................................................
119
4.1.3 Numeric
Strings .................................................................................
122
4.1.4 The Case
of Packed Numbers ..........................................................
124
4.1.5 Final
Overview of Type Mapping ....................................................
128
4.2 Working
with Structures .................................................................................
130
4.3 Working
with Internal Tables ........................................................................
136
4.3.1 Creating
an Internal Table in an External Program ........................
139
4.3.2
Administration of Data Records in an Internal Table ....................
142
4.3.3 Reading
and Writing Data Records in an Internal Table ...............
144
4.3.4 Overview
of the Functions for Internal Tables ..............................
148
4.4 The
Message Loop ...........................................................................................
148
4.5
Alternatives for Logging on to an R/3 System ............................................
151
4.5.1 Working
With a Configuration File .................................................
152
4.5.2 Working
with Load Balancing ..........................................................
153
4.5.3 Working with the
RfcOpen Function ..............................................
154
5 Troubleshooting 157
5.1 The ABAP
Debugger ........................................................................................
157
5.2 The BREAK
Statement .....................................................................................
160
5.3 The
Gateway Monitor ......................................................................................
161
5.4 The RFC
Trace ...................................................................................................
162
5.4.1 Structure
of the Trace File for an External Client ..........................
164
5.4.2 Structure
of the Trace File for an External Server .........................
166
5.4.3 Traces
Using Transaction ST05 .........................................................
167
5.5 The RFC
Generator ...........................................................................................
169
5.5.1 Structure
of the Client Program Generated ...................................
171
5.5.2 Structure
of the Server Program Generated ..................................
174
5.5.3 Macros
for Setting and Reading Values ..........................................
175
5.6 SAP Test
Programs ...........................................................................................
175
6 Advanced Techniques 181
6.1 Return
Calls from the Server ..........................................................................
181
6.2 Automatic
Creation of a Structure Description ..........................................
190
6.3
Transactional Remote Function Calls ...........................................................
196
6.3.1 The R/3
System as tRFC Client ........................................................
198
6.3.2
Programming a Transactional RFC Server .......................................
201
6.3.3
Transactional RFC Client ...................................................................
206
6.4 Queue RFCs
......................................................................................................
211
6.4.1
Administration of qRFCs in the R/3 System ...................................
212
6.4.2
Developing a qRFC Client in the R/3 System ................................
217
6.4.3
Developing an External qRFC Client ...............................................
221
6.4.4 tRFC and
qRFC Calls—Conclusion ..................................................
226
6.5 Error
Messages from an External Server ......................................................
227
6.5.1 Error
Messages from a Synchronous Server ...................................
227
6.5.2 Error
Messages from the tRFC and qRFC Servers .........................
231
6.6 Parallel
Processing ...........................................................................................
233
6.6.1
Multitasking and Multithreading .....................................................
234
6.6.2 Creating
and Exiting Threads ...........................................................
235
6.6.3 The
Basics of Synchronization ..........................................................
237
6.6.4
Synchronization Objects ...................................................................
242
6.6.5
Advantages of Parallel Processing in RFC Programming ..............
244
6.6.6
Implementing Parallel Processing in External Servers ...................
246
7 The Business Object 253
7.1 Business
Object—Close to the Object .........................................................
253
7.2 Structure of the
Business Object ..................................................................
256
7.3 The
Structure of the Business Object Builder .............................................
261
7.4 Creating
the Object Key ..................................................................................
264
7.5 Methods of
the Business Object ...................................................................
266
7.5.1
Instance-Dependent Methods .........................................................
267
7.5.2
Implementation of Methods Using ABAP Program Forms ...........
269
7.5.3 Creating
a Method ............................................................................
270
7.6 Object
Release and the Business Object Repository .................................
276
7.7 Guidelines
for Developing API Methods .....................................................
278
7.8
Possibilities for Activation ..............................................................................
280
8 Calling BAPIs from Clients 283
8.1 What Are
COM and ActiveX? .........................................................................
283
8.2 “What Is Your
Name?” or an Introduction to the Use of
ActiveX
Controls ...............................................................................................
287
8.2.1 The SAP
BAPI Control .......................................................................
287
8.2.2 Opening a
Connection with the R/3 System .................................
289
8.2.3 Calling
the Business Object Method ...............................................
291
8.2.4 What Is a
BAPI Proxy Object Anyway? ...........................................
295
8.3 Naming
Conventions During Programming .................................................
297
8.4 Wrapping
the BAPI Proxy Object ..................................................................
298
8.5 A Better
Method for Setting Up a Connection to the R/3 System ..........
301
8.5.1
Integrating the Logon Control into the Client ...............................
304
8.5.2 Events of
the SAPLogonControl Class .............................................
306
8.5.3
Recognizing a Disconnection ...........................................................
308
8.6 Concepts
for Creating Data Aggregates .......................................................
310
8.7 The SAP
TableFactory Control in Detail .......................................................
313
8.8
Administering Structures with the SAP TableFactory Control .................
314
8.8.1 Accessing
Data in Structures ............................................................
315
8.8.2 Note When
Working with Structures! ............................................
316
8.9 Working
with Tables ........................................................................................
318
8.9.1 The Class
Hierarchy for Working with Tables ................................
318
8.9.2 Important
Attributes of the Table Class ..........................................
319
8.9.3 Structure
of the Example Programs .................................................
320
8.9.4 Reading
Data Records in a Table .....................................................
321
8.9.5 Changing
Data Records .....................................................................
325
8.9.6
Alternatives for Creating the Field Description .............................
326
8.10
Visualization of the Table Contents ..............................................................
328
8.10.1
Hierarchy of the Classes of the TableView Control .......................
330
8.10.2
Specifying the Layout of the Data Grid ..........................................
331
8.10.3
Accessing the Cells in a Data Grid ...................................................
334
8.10.4
Specifying the Data Source for the Data Grid ................................
339
8.10.5 Concepts
for Inserting and Deleting Rows and Columns .............
343
8.10.6 Working with the
Clipboard ............................................................
346
9 SAP and Java 349
9.1 The SAP
Java Connector ..................................................................................
351
9.1.1 Basics of
the JCo ................................................................................
351
9.1.2 Ways of
Using the JCo ......................................................................
352
9.1.3 The JCo
Package ................................................................................
353
9.1.4 JCo
Releases .......................................................................................
354
9.2 Using the
JCo ....................................................................................................
354
9.2.1 Basic
Structure of a JCo Application ...............................................
354
9.2.2
Connection Setup ..............................................................................
354
9.2.3 Running
the RFC Modules ...............................................................
356
9.2.4 Access to
Data and Tables ................................................................
359
9.2.5 Complete
Example Program ............................................................
360
9.2.6
Troubleshooting and Tracing ...........................................................
366
9.2.7 Closing
Remarks ................................................................................
368
9.3 The Future
of the SAP Java Interface ............................................................
368
A Sources and Further Reading 371
Read
this SAP PDF material