Author: Pankuri Bansal & Nikhil Kumar
SAP in MuleSoft
- The Anypoint Connector for SAP is a helpful solution that allows companies to seamlessly integrate data between their systems and the SAP NetWeaver platform.
- SAP makes it easier to manage complex data exchanges without any hassles.
- Unfortunately, the Design Center feature of Anypoint Platform does not contain the SAP Connector.
- To utilize this connector, a separate license must be acquired. Please note that POC is not available on free accounts.
MuleSoft utilizes the SAP-certified Java connector, Anypoint Connector for SAP. Below are the SAP Connectors provided by MuleSoft.
Anypoint Mule Connectors are extremely useful for connecting multiple SAP systems, such as SAP S/4 HANA, ECC, and more. They can significantly simplify the integration processes and reduce the effort of setting up data flows.
SAP can perform all functions using the RFC Connector.
For BAPI: Asynchronous/Synchronous RFC, Function Listener, and GET Function are used according to use case requirements.
FOR IDOC: Document Listener, Retrieve IDOC
The only difference is the Function Names in BAPI Connectors and the IDOC Names in IDOC Connectors. Below is the screenshot for the same.
- GET (fetching data from the system)
- UPDATE/POST (updating and creating records in the system)
Prerequisites needed before performing any function in SAP
- Firstly, you need to select the connection type from the dropdown. Please see the screenshot for the same.
- Here, we are using the Simple Connection type, and for that, the below client credentials/access to the SAP System are needed.
- SAP libraries should be downloaded or provided by clients.
- These libraries shown in the below screenshots are required to be provided by clients or downloaded from SAP.
- If the customer has granted access to download these libraries, the download links are provided below.
Here are the jar names for the above libraries that we generally need to put there.
- JCO Library: sapjco3.jar
IDOC Library: sapidoc3.jar
JCO Native Library:
- This library requires 2 jar files – one for local (when you want to run on Studio) and the second for cloud (when you want to run on the platform).
- Since the studio works on Windows, we need a Windows library, and for the cloud, which works on Linux, we need a Linux library.
Cloud Lib: libsapjco3.so (Called so file)
Local Lib: sapjco3.dll (Called dll file)
Note: Whenever we are deploying the Jar on the cloud, the developer needs to replace the SAP local library (dll file) with the cloud library jar (so file).
POM Dependencies of above JARS:
<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.idoc</groupId> <artifactId>com.sap.conn.idoc.sapidoc3</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>
POM Plugin Configuration of JARS:
<configuration> <sharedLibraries> <sharedLibrary> <groupId>com.sap.conn.jco</groupId> <artifactId>com.sap.conn.jco.sapjco3</artifactId> </sharedLibrary> <sharedLibrary> <groupId>com.sap.conn.idoc</groupId> <artifactId>com.sap.conn.idoc.sapidoc3</artifactId> </sharedLibrary> <sharedLibrary> <groupId>com.sap.conn.jco</groupId> <artifactId>libsapjco3</artifactId> </sharedLibrary> </sharedLibraries> <classifier>mule-application</classifier> </configuration>
Now, let’s talk about SAP functions.
SAP FUNCTIONS are of two types:
- BAPI FUNCTIONS for which we have connectors:
Get function, Asynchronous/Synchronous remote function call, and function listener.
- There are SAP tables also, and you can use any of them as per use-case requirements.
- IDOC FUNCTIONS for which we have connectors:
Send idoc, retrieve idoc and document listener
They are also of two types:
- Standard: These are, in general, examples we are having. For example, for getting material object data (BAPI_MATERIAL_GET_DETAIL)
-> For tables : RFC_READ_TABLE to fetch data
But for creating data into a table you need CUSTOM FUNCTION because in standard TABLE Function RFC.
(Remote function call is not enabled, which is why developers are not able to use Mule SAP Connectors.)
- Custom: SAP developers can create connectors for their private usage, where they can add their choice of fields, for example, xyzBAPI.
Difference between BAPI and IDOC
A BAPI (Business Application Programming Interface) is a functional module that enables communication with SAP.
IDOCs (intermediate documents) are documents used to transfer data between SAP systems or from SAP to non-SAP systems.
That’s all for SAP introduction.
https://www.tcodesearch.com/sap-tables/KNA1 (Standard SAP Tables )
https://anypoint.mulesoft.com/exchange/org.mule.examples/mulesoft-accelerator-for-sap/ (Standard BAPI Functions Discussions)