Development2020.04.24 3 min. read

SAP IDOC Integration

Piyush Sharma Senior Integration Developer

This blog aims to help developers when they want to integrate SAP system with any other system. In this specific integration we are listening to incoming IDOC from SAP, process and send them to end system. Also, we will be sending IDOCs back to SAP system as well.

About Connector

SAP Connector – Mule 4 (version 5.1): Anypoint Connector for SAP (SAP Connector) enables the integration of data to and from external systems based on SAP NetWeaver. This connector requires a separate license. Contact MuleSoft to evaluate or use this connector in production.

https://docs.mulesoft.com/connectors/sap/sap-connector

Prerequisites

SAP Libraries

To use SAP libraries in your Mule project, you must first download the libraries to your computer. You can use the three libraries in Anypoint Studio directly, without conversion. You must have an SAP ID to download the libraries.

The file types for each library depend on your operating system:

OSFile Types
Windowssapidoc3.jar
sapjco3.jar
sapjco3.dll
Mac OSsapidoc3.jar
sapjco3.jar
libsapjco3.jnilib
Linuxsapidoc3.jar
sapjco3.jar
libsapjco3.so

https://docs.mulesoft.com/connectors/sap/sap-connector-studio

It is recommended that SAP libraries version should be 3.0.18 or above.

SAP Configuration Parameters

In order to maintain successful connection, some of the configuration would be required from SAP Basis team which is mentioned below in screenshots.

SAP Global Configuration

There are mainly two kind of configuration you can do in anypoint global configuration. It depends on how underlying SAP system is setup.

https://docs.mulesoft.com/connectors/sap/sap-connector-reference

Common Document listener configuration:

Application Server

If SAP server is setup using application server, then global configuration would be used as below:

Load Balanced Server

When SAP system is load balanced, there lies many application servers behind it. In this case we use message server host instead of application server. Global configuration would be used as below:

Send IDOC

You need to search the name of IDOC which you want to send to SAP. Drag and drop a transformer before it and it will generate metadata. Map the fields which this IDOC structure require and send the payload to SAP.

Common Problems

Most of the problems you may encounter during project implementation is related to SAP configuration at backend system and network and firewall issues. These can be as follows:

  • SAP Program ID is not setup correctly.
  • Encoding issue at SAP side.
  • Wrong IPs or host and port.
  • Ports and IPs are blocked by firewall team, or IPs may not be in VPC range.
  • While using load balanced connection, all underlying application server IPs are not whitelisted.
  • If using natted IPs, correct IPs need to be configured.
  • IPs or host are not reachable from cloudhub.
  • Invalid firewall rules for the application deployed in that region.

 Workaround

To check connectivity of IPs and port from cloudhub, you can install network tools application and try to run ping or socket command from cloudhub for that IP. If that IP is reachable, that means connection can be established if not, you want to reach out to SAP Basis team or network team with test result.

https://help.mulesoft.com/s/article/How-To-Use-Network-Tools-Application

For all other SAP related connectivity issue, turn verbose logging on and send the logs to SAP team for investigation. You can enable JCO Trace on for troubleshoting as well.

https://help.mulesoft.com/s/article/How-to-enable-debug-logging-and-SAP-JCO-Trace-for-MuleSoft-SAP-connector

You might require to run some commands on cmd or telnet to ping the ip or know the ip address behind hostname from local machine.

https://support.code42.com/CrashPlan/6/Troubleshooting/Test_your_network_connection

Useful Information

Program ID is set up per environment. If SAP have Dev and Prod environment, then there will be two program ID for both environments. It may vary, depends on SAP team.

In case of application server, it is often seen, that gateway service is system number prefix with “33”. For example: if System Number = 74 then gateway service = 3374

In case of load balanced server configuration, it is often seen, that gateway service is system number prefix with “33”. Also, message server port will also be system number prefix with “36”. For example: if System Number = 74 then gateway service = 3374 and message server port = 3674. Gateway host and message server host remains same.

All these configurations need to be confirmed by SAP basis team who manage these connection configurations.

Post author

Piyush Sharma

Senior Integration Developer

Contact us

Do you want to know, what we can do for you? Let's talk!

Contact