Author: Akshata Sawant

Stuck while resolving issues with dependency, configurations with SAP Connector? Check out some easy and handy points if you’re a naive user to SAP.

Firstly, If you want to connect to SAP via MuleSoft you can use ready to go SAP Connector or you can connect via traditional way using Web Service Consumer.

We’ll see how to get connected to SAP using Mulesoft SAP Connector. Here I’ll be using SRFC Function to invoke BAPI Function call

As a MuleSoft professional and a newcomer in SAP, you might hear about various acronyms and there are high chances you might get confused or scared so don’t forget to check out SAP Acronyms before you panic 🙂 

Once that you’ve pulled out SAP Connector from Mule Palette. This is what your configurations will look like. 

Connector Configurations:

While configuring the connector you can opt for one of the two either select “Certificate” or  “Simple Connector Provide”. I’ve chosen the latter one.

Then comes the most important part (i.e configuring Libraries). You need to really be careful while choosing libraries.

First, two libraries that are IDoc Library and Jco Library are pretty straight forward and you’ve jar files available for them.

For the last one, Jco Native Library you need to import Library which is in .so format if you’re deploying to CloudHub or Linux based OS system.

CloudHub workers are based on Linux 64 bits virtual machines, running on an Intel/AMD 64 bits architecture (x86_64). So in order to avoid the error in Cloudhub, you need to add the native library for Linux x86 64 bits (libsapjco3.so) with the type so.

Jco native Library is dependent on the OS and hence It’ll vary for different OS

——————————————————————————————

# This is for Mac Only

mvn install:install-file -DgroupId=com.sap.conn.jco -DartifactId=libsapjco3 -Dversion=3.0.18 -Dpackaging=jnilib -Dfile=libsapjco3.jnilib 

# This is for Windows Only

mvn install:install-file -DgroupId=com.sap.conn.jco -DartifactId=libsapjco3 -Dversion=3.0.18 -Dpackaging=dll -Dfile=sapjco3.dll 

# This is for Linux Only

mvn install:install-file -DgroupId=com.sap.conn.jco -DartifactId=libsapjco3 -Dversion=3.0.16 -Dpackaging=so -Dfile=sapjco3.so

With above dependency installed lets change pom.xml,  

——————————————————————————————————-

Add below shared libraries :

<sharedLibraries>

                    <sharedLibrary>

                           <groupId>com.sap.conn.idoc</groupId>

                           <artifactId>com.sap.conn.idoc.sapidoc3</artifactId>

                        </sharedLibrary>

                    <sharedLibrary>

                           <groupId>com.sap.conn.jco</groupId>

                           <artifactId>com.sap.conn.jco.sapjco3</artifactId>

                        </sharedLibrary>

                    <sharedLibrary>

                            <groupId>com.sap.conn.jco</groupId>

                           <artifactId>libsapjco3</artifactId>

                        </sharedLibrary>

  </sharedLibraries>

—————————————————————————————————————-

In the dependencies section in the pom.xml file, add the SAP libraries dependencies

         <dependency>

           <groupId>com.sap.conn.idoc</groupId>

           <artifactId>com.sap.conn.idoc.sapidoc3</artifactId>

           <version>3.x.x</version>

        </dependency>

         <dependency>

           <groupId>com.sap.conn.jco</groupId>

           <artifactId>com.sap.conn.jco.sapjco3</artifactId>

           <version>3.x.x</version>

        </dependency>

         <dependency>

           <groupId>com.sap.conn.jco</groupId>

           <artifactId>libsapjco3</artifactId>

            <version>3.x.x</version>

           <classifier>external-library</classifier>

            <type>so</type>

        </dependency>

—————————————————————————————————————-

Once you’re done configuring Libraries you’re ready to go to next step and fill in your

UsernamePasswordSAP System number (which can be like 100,200 or ),

SAP Client ID and Application Server Host. Once done with your configurations you’re ready to go. Test your Connection.

Most Common Error that we get while deploying SAP-based integration to Cloudhub is  –

Failed to invoke lifecycle phase “initialise” on object: org.mule.runtime.module.extension.internal.runtime.config.ConfigurationProviderToolingAdapter@41544bcf

java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path

And it’s mainly due to incorrect libraries used.

Leave a Comment