the SAP Java Connector, or JCo library, is an SAP delivered tool for connecting programs written in Java to the R/3. Most articles deal with external applications connecting to SAP R/3, but JCo provides the capability for SAP to call your java application as well. In this blog post, we’ll cover how to correctly setup SAP to call your java application.
In this first installment, I will just cover basic architecture and connection needs.
To create and run a java server successfully, we need the following two things:
- Proper connection Parameters
- A function template of your function in R/3
Proper Connection Parameters
In order to connect and use the JCo Server with R/3, the following items must be known:
- Gateway host – The SAP gateway server name or IP address
- Gateway Service Number – The service number is related to the SAP system number and starts at sapgw00
- Program ID – The Program ID must match the Program ID registered in SM59
This information is available most likely from a Basis administer. The RFC registration matching is a common problem. The a sample Program ID is shown below. This HAS to match the program ID you start your JCO.Server object with.

SM59 Registration Configuration
Functional Template
A JCo server needs to have the skeleton of the program in R/3. SAP cannot just call your external java program without the import, export, and table parameters defined within the system. Instead of creating a custom RFC for this example, I’ll use a pre-existing one. remember, we are only using the import, export, and table parameters, the code is running on our java server. The BAPI we are going to use is BAPI_CUSTOMER_GETDETAIL.
After these two things are in place, we are ready to start coding.
The next post will cover:
- JCO.Server Object
- JCO.Repository Object
- JCO.Client Object
The next posting is Server Programming in JCo Part 2