SAP Connector
SAP Connector
About SAP Transport for Mule 2
The SAP Transport for Mule 2 allows to communicate SAP ERP Systems. You can send a XML message that is equivalent to a BAPI function request and receive a XML message that is equivalent to a BAPI function response. The SAP Transport uses SAP JCo library to invoke SAP BAPI funciton.

Examples
Request Message
The following xml message is for invoking BAPI_CUSTOMER_GETLIST(http://abap.wikiprog.com/wiki/BAPI_CUSTOMER_GETLIST).
<jco name="BAPI_CUSTOMER_GETLIST" version="1.0">
<tables>
<table name="IDRANGE">
<row id="0">
<field name="SIGN">I</field>
<field name="OPTION">CP</field>
<field name="LOW">*</field>
<field name="HIGH"></field>
</row>
</table>
</tables>
</jco>
Response Message
The following xml is a response message from BAPI_CUSTOMER_GETLIST.
<jco name="BAPI_CUSTOMER_GETLIST" timestamp="1244428169383" version="1.0">
<import>
<field name="CPDONLY"/>
<field name="MAXROWS">0</field>
</import>
<export>
<structure name="RETURN">
<field name="TYPE"/>
<field name="ID"/>
<field name="NUMBER">000</field>
......
</structure>
</export>
<tables>
<table name="ADDRESSDATA">
<row id="0">
<field name="CUSTOMER">VENDER01</field>
<field name="SORT1">Z004</field>
.....
</row>
<row id="1">
<field name="CUSTOMER">VENDER02</field>
<field name="SORT1">TEST</field>
.....
</row>
</table>
<table name="IDRANGE">
<row id="0">
<field name="SIGN">I</field>
<field name="OPTION">CP</field>
<field name="LOW">*</field>
<field name="HIGH"/>
</row>
</table>
<table name="SPECIALDATA">
<row id="0">
<field name="CUSTOMER">VENDER01</field>
<field name="ACC_1_TIME"/>
</row>
<row id="1">
<field name="CUSTOMER">VENDER02</field>
<field name="ACC_1_TIME"/>
</row>
</row>
</table>
</tables>
</jco>
Prerequisites
| Pre-Requisite | Version | Notes |
|---|---|---|
| JDK | 1.5.x or 1.6.x | Set the $JAVA_HOME environment variable to point to the JDK. Add the $JAVA_HOME/bin to the $PATH environment variable. For compiling the SAP transport, you will need JDK 1.5.x. |
| Mule | 2.2.1+ | doesn't work with 1.4.x nor 2.0.x. |
| SAP JCo Library | 3.0+ | |
| Subversion | any | You will need it for building from source |
| Maven | 2.0.9+ | You will need it for building from source |
| Ant | 1.7.0+ | You will need it for building from source |
Installing a Binary distribution
Currently, we don't provide binary distribution.
Installing from Source
Installing and setting up build environment
- Installing JDK
- Installing Maven2
- Installing Ant
Compiling and building the SAP transport
-
Installing 3rd party library
Product File Name version Notes SAP JCo Library sapjco3.jar 3.0+ Notes You must download the library from https://websmp204.sap-ag.de/connectors.
You need a username and password to acces the site. Please ask your SAP system manager.
To install the library, please see/modify/run trunk/mvn-install.sh. -
building and installing the SAP Transport
$ mvn installYou must set the $MULE_HOME environment variable properly.
-
copying sapjco3.jar to mule library directory
$ cp sapjco3.jar $MULE_HOME/lib/opt
Example Application
Please see an example in trunk/examples/simple.
Running the Example
-
Editing mule config file
Please modify trunk/examples/simple/config/mule-config.xml for your environment.
-
Starting mule server
$ cd trunk/examples/simple
$ ./run.sh
-
Sending a request message
$ cp data/CUSTOMER_GETLIST.xml in
-
Checking a result
You can get a response xml message from SAP transport in the result directory.
Important notice
In JCo 3.x, information for SAP connection is stored in a flat file with jcoDestination extension.
For example, the following connection is declared in mule config, a file named SapEndpoint.jcoDestination is created when SAP transport is connected to SAP server first time and reused.
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
...
<sap:endpoint name="SapEndpoint"
address="sap://sap-endpoint" jcoClient="800" jcoUser="P9375361"
jcoPasswd="TESTTEST" jcoLang="JA" jcoAshost="158.201.70.174"
jcoSysnr="00" jcoTrace="true" jcoPoolCapacity = "3"
jcoPeakLimit="10" />
...
</mule>
If you change SAP connection attributes, please delete this file before run SAP transport.
Roadmap
We are considering the following features on the next major release.
- XML schema validation for request XML message
- Transaction control from Mule SAP transport
- Extract metadata as XSD from SAP repository