Java SAP R/3 Integration
November 2004
Abstract
Enterprises of all descriptions have long sought to integrate and manage all their information
assets within a single system. The goal remains elusive because enterprises create and store
their assets in a myriad of disparate systems - relational databases, mainframes, different
operating systems, hierarchical repositories, and so on. Using new and existing assets in an
efficient, integrated, and interchangeable manner has become the key to surviving, and
thriving in the new economy.
SAP remains the world leader in enterprise-software domain, with over 11000 installations
worldwide. With over 60% of market share in ERP segment, it becomes an obvious choice for
the EAI and EII product vendors to target SAP R/3 Enterprise as a data source, and therein
emerges the need for integration. With the emergence of Java as a platform for developing
enterprise applications and its portability across different Operating Systems, it becomes the
obvious platform for integration with SAP R/3 Enterprise.
Keywords: SAP R/3, RFC, BAPI, IDoc, JCo
Author: Manoj Gangwani
Persistent Systems Private Limited
P
E
R
S
I
S
T
E
N
T
W
H
I
T
E
P
A
P
E
R
Java SAP R/3 Integration
Contact details
Persistent Systems Private Limited,
"Bhageerath", Senapati Bapat Marg,
Pune, India 411 016
Telephone: +91 (20) 2567 8900
Fax: +91 (20) 2567 8901
Email: whitepapers@persistent.co.in
Web: http://www.persistent.co.in
Publication and copyright details
Copyright © 2004 Persistent Systems. All rights reserved. No part of this publication may be reproduced,
transmitted, transcribed, stored in a retrieval system, or translated into any language, in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise, without prior written permission
from Persistent Systems. Written and printed in India.
The information furnished herein is believed to be accurate and reliable. However, no responsibility is
assumed by Persistent Systems for its use, or for any infringements of patents or other rights of third parties
resulting from its use.
Persistent Systems Private Limited
2 of 17
Java SAP R/3 Integration
TABLE OF CONTENTS
Introduction
Aim
Intended Audience
SAP R/3 Enterprise
Overview
Architecture
Integration Interfaces
Remote Function Calls (RFC)
SAP BO, BOR and BAPI
Application Link Enabling (ALE) and IDocs
Java SAP R/3 Integration
SAP Java Connector (JCo)
Implementing JCo Client
Creating Connection Pool
Creating Repository
Creating Function Template
Creating Function
Getting Connection
Providing Inputs
Executing Function
Accessing Output
Destroying Connection Pool
Issues
Performance
Connection Pooling
Use a Fresh Function Object
Use Only One Repository
Inactive Table Parameters
Appending Multiple Table Rows
Synchronization
5
5
5
5
5
5
6
6
7
9
10
10
11
11
11
11
12
12
12
12
12
12
12
12
12
12
13
13
13
13
Persistent Systems Private Limited
3 of 17
Java SAP R/3 Integration
BAPI, State, and Commit
Appendix
Terms
Sample Code
Reference
13
14
14
14
17
Persistent Systems Private Limited
4 of 17
Java SAP R/3 Integration
Introduction
Aim
This section provides you an overview of the SAP R/3 Enterprise, different
integration interfaces exposed by it and integration of an application with SAP
R/3 using Java platform. This white paper assumes that you already know
Java. Some knowledge of SAP is also desirable, but you should be able to get
by even if you don’t know much about SAP. This document will cover all
aspects of integration with SAP R/3 Enterprise using Java as a platform.
Intended Audience
This document is intended for developer(s)/architect(s) embarking on EAI/EII
projects involving integration with SAP R/3. They will find this document
suitable for obtaining a quick overview of the SAP R/3 Enterprise and different
integration interfaces exposed by the same. It will also give them a quick
overview of the SAP’s Java Connector, with some details on the issues
involved in such integration projects.
SAP R/3 Enterprise
Overview
SAP’s R/3 System has set new norms for standard software that can be
universally implemented. R/3 uses advanced development techniques to
achieve comprehensive integration of business administration and data
processing. It combines state-of-the-art technology with comprehensive
business administration functionality to provide a fully integrated business
solution for an enterprise.
SAP stands for Systems Applications and Products for data processing.
Architecture
SAP R/3 is event-driven transaction processing software for business events
in an organization’s primary value chain. Transaction processing systems
supported by enterprise software are most concerned with the day-to-day
needs of a business in conducting its on-going activities.
Persistent Systems Private Limited
5 of 17
Java SAP R/3 Integration
Figure 1: SAP R/3 Enterprise Architecture
The R/3 Basis is the software that implements SAP three-tier client/server
architecture. It consists of application modules and application servers, which
are distinct components. The application modules support all of a company’s
business transactions and are integrated interactively. All application modules
share data through the R/3 database, which contains the data for all modules.
Integration Interfaces
Remote Function Calls (RFC)
A Remote Function Call (RFC) is the call of function module in a partner
system. The caller is the RFC client and the called partner is the RFC server.
RFC is based on the known RPC model from the UNIX-TCP/IP environment.
RFC in SAP environment is based on a CPI-C interface implemented by SAP.
Persistent Systems Private Limited
6 of 17
Java SAP R/3 Integration
Figure 2: Remote Function Call
The remote call of a function module is easier for an application programmer
to use than program-to-program communication, because data is exchanged
only using predefined parameters.
SAP BO, BOR and BAPI
SAP Business Objects (BO)
Business model objects for the real world (for example, employees, customer
orders, and so on) are reproduced in R/3 as business objects. A business
object encapsulates the business processes and the data linked to it. These
objects can be seen as being multi-layered.
Persistent Systems Private Limited
7 of 17
Java SAP R/3 Integration
Figure 3: SAP Business Object (BO)
The innermost layer is made up of the actual data and its structures. The
second layer maintains integrity. It represents the business logic of the object
and describes the business rules and limitations for the business object. The
interface layer describes the implementation and structure of the object. The
interface layer allows access to the attributes, methods, and events that are
defined for the object.
SAP Business Object Repository (BOR)
The Business Object Repository (BOR) contains the SAP business object types
and SAP interface types as well as their components, such as methods,
attributes, and events.
The BOR has the following functions:
• Enables an object-oriented view of the R/3 System data and
processes.
• Arranges the various interfaces in accordance with the component
hierarchy.
• Manages BAPIs in release updates.
SAP Business Application Programming Interface (BAPI)
SAP BAPIs provide developers with stable, reliable interfaces for accessing the
functionality offered by SAP business objects. BAPIs can reduce the
development cost by providing built-in functionality through predefined
methods of the SAP business objects. These methods can reduce
programming time in deployment projects.
Persistent Systems Private Limited
8 of 17