Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor

Update 9 May 2016: Due to limitation of number of uploaded images allowed in a post, Part 1 of this series has been split further into two parts (1a - this post, and 1b - Demystifying Custom Adapter Development: Part 1b - Cloning the Sample JCA Adapter)


One of the final frontiers of Java development in PI is the development of a custom adapter. Unlike other Java developments in PI (mappings, adapter modules) which have extensive coverage in terms of documentation and guides, custom adapter development materials are few and far between. Although the following SAP Library link provides the steps for Developing a Java Adapter for SAP PI, these steps have not been updated since XI 3.0 days and in practice, the steps are somewhat vague with certain information missing that is required for proper development and deployment of the adapter.

With all these "hurdles" and no proper guide, it is no wonder that the following blog mentions that there is a high learning curve involved and the cost may come up to $500K.

Do you need a custom adapter in PI?

Due to these prohibitive factors, many alternative workarounds have been used to meet the various integration needs. Some of these involves developing IO connection in Java mappings or adapter modules even though these violates EJB's specification.

Over the next few weeks, I'll be sharing a series of posts covering the various aspects of custom adapter development. The aim is to shorten the learning curve by illustrating both the basics as well as the key points of such developments.

Without further ado, we will begin with the necessary setup and configuration to reproduce a clone copy of the sample JCA adapter provided by SAP.

Step 1 - Getting All the Necessary Files

As the first step, we need to get all the necessary files required to set up the project correctly. These are:-

i) The source code for the sample JCA adapter

ii) The configuration and deployment descriptor files

iii) The reference JAR library files for adapter development

i) Sample adapter source code

The source code is no longer provided in the installation SCA files. However these are available as an attachment in an older version of the following SAP Note:-

1004000 - SAP NetWeaver PI Adapter/Module Development: API Changes

Switch to version 20 of the note and download the attached ZIP file.

Extract the ZIP file into a suitable temporary location in the local computer.

ii) Configuration and deployment files

These files are not included in the above ZIP file (and even the external link provided in the SAP Note is not working). However, these are included in the Adapter Framework SCA file that can be downloaded from SMP.

Go to the Download Software section of SMP, and select Support Packages & Patches.

Navigate to the section for XI Adapter Framework as shown below and download the XIAF SCA file. Note that although the screenshot shows the SCA file that is relevant to my PI system, it is actually not really important which version of PI or SP level that is downloaded, as we just need a copy of the files.

Open the SCA file in a ZIP utility like 7-Zip, and navigate to the following RAR entry within the SCA file to access the sample adapter's file.

Open the RAR file and extract the following two folders to a temporary location in the local computer.

iii) PI adapter development reference libraries

Although NWDS 7.31 (and above) contains built-in libraries that are sufficient for mapping or adapter module development, there are a few more library files required for adapter development.

Retrieve the following four files from the PI system (either by accessing them directly at OS level or using an approach like Browsing File System of a Java-only System)





Step 2 - Setting Up the Project in NWDS

With all the necessary files in place, we can proceed to set up the following projects in NWDS:-

i) Java Project for the adapter source codes

ii) Connector Project for the RAR file generation

i) Adapter Java Project

Create a new Java project in NWDS. The project name is arbitrary but some of the subsequent files will refer to it, so it is recommended to follow some form of naming convention.

Next, create a package within the project. The package name needs to be exactly (don't worry, this will be refactored later) in order to match the package declaration in the sample source codes.

With the package in place, copy the sample source codes that were extracted above (in Step 1 - i) and paste it into the package.

Initially, there will be various errors for the source codes. These need to be rectified by configuring the build path. Add the following two built-in libraries to the project.

Next, add the four PI adapter libraries as External JARs as shown below. Once this is done, the project will compile and build successfully.

ii) Connector Project

Select File > New > Connector Project to create the RAR project and accept the default values.

The project will be created with default files in the META-INF folder.

These need to be replaced by the following seven files that were extracted from the XIAF SCA file above (in Step 1 - ii).

Copy and paste the files into the META-INF folder (overwriting any existing files). The final view of the RAR project is as follows.

Step 3 - Modifying the Source Code and Configuration Files

As the existing sample JCA adapter is normally already deployed in the PI system, we need to make some modifications to the codes and configuration files in order to be able to deploy a clone copy of the adapter.

i) Rename the package in the Java project

Right click on the package and select Refactor > Rename, providing an appropriate name according to a suitable naming convention. This automatically updates all the underlying source codes with the new package name.

ii) Update adapter type and namespace in

Open the above class, and navigate to the run() method. Modify the values for adapterType and adapterNamespace.

Note that this is a very crucial step, as it affects the actual registration of the adapter to the framework during deployment. The combination of these two values must be a unique pair.

iii) Update the deployment descriptor ra.xml

Open the ra.xml file in the META-INF folder of the RAR project. Update the following three values with the same package name that was used in item i) above.

In the same file, update the following values for the adapter type and namespace with the same value used in item ii) above.

iv) Update log-configuration.xml

Update the following values in the log configuration files. These values affect the logging that is displayed in NWA's Log Viewer.

v) Update the deployment file SAP_MANIFEST.MF

This file affects the deployment of the adapter. The combination of keyvendor and keyname values must be a unique pair so that it does not clash with other applications that are already deployed in the system.

The continuation steps for Part 1 are listed in the following post:-

Demystifying Custom Adapter Development: Part 1b - Cloning the Sample JCA Adapter

Other Parts of this Series

Demystifying Custom Adapter Development: Part 1b - Cloning the Sample JCA Adapter

Demystifying Custom Adapter Development: Part 2 - Examining the Adapter's Key Classes and Methods

Demystifying Custom Adapter Development: Part 3 - Examining the Deployment and Metadata Files

Demystifying Custom Adapter Development: Part 4 - Modifying the Adapter's Functionality

Demystifying Custom Adapter Development: Part 5 - Creating an HTTP Poller with OAuth 2.0 authenticat...

Labels in this area