{{announcement.body}}
{{announcement.title}}

Connecting SAP Application Server Using MuleSoft SAP Connector

DZone 's Guide to

Connecting SAP Application Server Using MuleSoft SAP Connector

MuleSoft SAP Connector enables Mule runtime engines to support SAP integration, as a certified SAP Java connector.

· Integration Zone ·
Free Resource

Introduction

MuleSoft SAP Connector enables Mule runtime engines to support SAP integration, as a certified SAP Java connector that leverages SAP Java Connector (JCo) libraries.

Usage of SAP Connector

  • Execute the BAPI functions over the following type of RFCs (Remote Function Calls).
    • Synchronous Remote Function Call (sRFC).
    • Asynchronous Remote Function Call (aRFC).
  • Sends and Receive IDocs over Transactional Remote Function Call (tRFC) and Queued Remote Function Call (qRFC).
  • Transform SAP Object from and to XML.
  • Act as a JCo server to be called a BAPI over sRFC and aRFC.
You may also like: Let's Talk about APIs with SAP [Video]

Setting Up SAP Connector With AnyPoint Studio

By default, SAP connector is not available in the AnyPoint Studio palette. You need to search and download SAP connector from an exchange.

mulesoft

Click Finish. It will install the SAP connector with all available operations in AnyPoint palette.

AnyPoint palette

Establishing the Connection With SAP Application Server

SAP connector provided two ways for connecting SAP system, Application Server and Message Server. In this tutorial, we will see how we can connect the SAP Application server using SAP connector.

For establishing the connection, you will be requiring below JCo libraries that you can get it from the SAP marketplace.

Two Multi-Platform Libraries

  • sapjco3.jar
  • sapidoc3.jar

One JCO native library

  • sapjco3.dll (Windows)
  • libsapjco3.jnilib (Mac OS X)
  • libsapjco3.so (Linux)

We will be using SAP Synchronous Remote Function Call operation to retrieve data from SAP system.

Synchronous Remote Function Call

Now, you can start connector configuration and first make sure that you provide all three JCO libraries in connector configuration.

First, we will configure IDoc Library by clicking on Configure -> Use local file. Browse sapidoc3.jar.

Click OK.

"Choose local file"Similarly, configure the JCo library and JCo native library.

You can get all these libraries from SAP Marketplace.

simple connection provider

To connect SAP Application Server, you need to provide Username, Password, SAP system number (e.g. 00, 01), SAP client ID (e.g. 500, 800), Application server host.

After doing all this configuration, you can simply click on Test connection to check whether all configuration is correct and we are able to connect SAP.

test connection

Click OK. This completes the SAP connector configuration. Now you need to provide Key (i.e. Function that you have to call from SAP to retrieve data) and Metadata in Key will be populated automatically. Click on the search icon and select the Function that you need to execute.

providing a key

You will see request and response metadata is generated automatically in the transform message required to execute the SAP function that we have configured above.

SAP

Similarly, you can use other SAP connector operations to send and retrieve IDocs and other operations.

Considerations While Deploying To CloudHub

When you are deploying your application to CloudHub Runtime Manager, you need to make sure that JCo native library is libsapjco3.so added at build path and in pom.xml because Cloudhub workers are running on Linux operating system otherwise it will give error java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path.

Conclusion

MuleSoft SAP Connector is very powerful and provides many operations to retrieve data from SAP. in form IDoc, BAPI and Remote Function call.SAP Connector is one of the most used connectors.

This is how you can use SAP connector to send and retrieve IDocs, execute BAPI functions synchronously and asynchronously.

Connecting SAP System With MuleSoft SAP Connector Application Server Configuration [Video]


Further Reading

Cloud Elements Extends SAP S/4HANA With 3rd Party Integrations

SAP Integration With MuleSoft

SAP Integration in Mule ESB

Topics:
sap ,mulesoft ,tutorials ,integration ,anypoint ,sap connector ,anypoint studio

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}