Connect to SAP systems from Azure Logic Apps

This article shows how you can access your SAP resources from inside a logic app by using the SAP Application Server and SAP Message Server connectors. That way, you can automate tasks, processes, and workflows that manage your SAP data and resources by creating logic apps.

This example uses a logic app that you can trigger with an HTTP request. The logic app sends an Intermediate Document (IDoc) to an SAP server, and returns a response to the requestor that called the logic app. The current SAP connectors have actions, but not triggers, so this example uses the HTTP request trigger as the first step in the logic app's workflow. For SAP connector-specific technical information, see these reference articles:

If you don't have an Azure subscription yet, sign up for a free Azure account.


To follow along with this article, you need these items:

  • The logic app from where you want to access your SAP system and a trigger that starts your logic app's workflow. The SAP connectors currently provide only actions. If you're new to logic apps, review What is Azure Logic Apps and Quickstart: Create your first logic app.

  • Your SAP Application Server or SAP Message Server

  • Download and install the latest on-premises data gateway on any on-premises computer. Make sure you set up your gateway in the Azure portal before you continue. The gateway helps you securely access data and resources are on premises. For more information, see Install on-premises data gateway for Azure Logic Apps.

  • Download and install the latest SAP client library, which is currently SAP Connector (NCo) for Microsoft .NET Framework 4.0 and Windows 64bit (x64), on the same computer as the on-premises data gateway. Install this version or later for these reasons:

    • Earlier SAP NCo versions can become deadlocked when more than one IDoc messages are sent at the same time. This condition blocks all later messages that are sent to the SAP destination, causing the messages to time out.

    • The on-premises data gateway runs only on 64-bit systems. Otherwise, you get a "bad image" error because the data gateway host service doesn't support 32-bit assemblies.

    • Both the data gateway host service and the Microsoft SAP Adapter use .NET Framework 4.5. The SAP NCo for .NET Framework 4.0 works with processes that use .NET runtime 4.0 to 4.7.1. The SAP NCo for .NET Framework 2.0 works with processes that use .NET runtime 2.0 to 3.5 and no longer works with the latest on-premises data gateway.

  • Message content you can send to your SAP server, such as a sample IDoc file. This content must be in XML format and include the namespace for the SAP action you want to use.

Add HTTP request trigger

In Azure Logic Apps, every logic app must start with a trigger, which fires when a specific event happens or when a specific condition is met. Each time the trigger fires, the Logic Apps engine creates a logic app instance and starts running your app's workflow.

In this example, you create a logic app with an endpoint in Azure so that you can send HTTP POST requests to your logic app. When your logic app receives these HTTP requests, the trigger fires and runs the next step in your workflow.

  1. In the Azure portal, create a blank logic app, which opens the Logic App Designer.

  2. In the search box, enter "http request" as your filter. From the triggers list, select this trigger: Request - When a HTTP request is received

    Add HTTP Request trigger

  3. Now save your logic app so you can generate an endpoint URL for your logic app. On the designer toolbar, choose Save.

    The endpoint URL now appears in your trigger, for example:

    Generate URL for endpoint

Add SAP action

In Azure Logic Apps, an action is a step in your workflow that follows a trigger or another action. If you haven't added a trigger to your logic app yet and want to follow this example, add the trigger described in this section.

  1. In the Logic App Designer, under the trigger, choose New step > Add an action.

    Add an action

  2. In the search box, enter "sap server" as your filter. From the actions list, select the action for your SAP server:

    • SAP Application Server - Send to SAP
    • SAP Message Server - Send to SAP

    This example uses this action: SAP Application Server - Send to SAP

    Select "SAP Application Server" or "SAP Message Server"

  3. If you're prompted for connection details, create your SAP connection now. Otherwise, if your connection already exists, continue with the next step so you can set up your SAP action.

    Create on-premises SAP connection

    1. For Gateways, select Connect via on-premises data gateway so that the on-premises connection properties appear.

    2. Provide the connection information for your SAP server. For the gateway property, select the data gateway you created in the Azure portal for your gateway installation, for example:

      SAP Application Server

      Create SAP application server connection

      SAP Message Server

      Create SAP message server connection

    3. When you're done, choose Create.

      Logic Apps sets up and tests your connection, making sure that the connection works properly.

  4. Now find and select an action from your SAP server.

    1. In the SAP action box, choose the folder icon. From the folder list, find and select the action you want to use.

      This example selects the IDOC category for the IDoc action.

      Find and select IDoc action

      If you can't find the action you want, you can manually enter a path, for example:

      Manually provide path to IDoc action

      For more information about IDoc operations, see Message schemas for IDOC operations

    2. Click inside the Input Message box so that the dynamic content list appears. In that list, under When a HTTP request is received, select the Body field.

      This step includes the body content from your HTTP request trigger and sends that output to your SAP server.

      Select "Body" field

      When you're done, your SAP action looks like this example:

      Complete SAP action

  5. Save your logic app. On the designer toolbar, choose Save.

Add HTTP response action

Now add a response action to your logic app's workflow and include the output from the SAP action. That way, your logic app returns the results from your SAP server to the original requestor.

  1. In the Logic App Designer, under the SAP action, choose New step > Add an action.

  2. In the search box, enter "response" as your filter. From the actions list, select this action: Request - Response

  3. Click inside the Body box so that the dynamic content list appears. From that list, under Send to SAP, select the Body field.

    Complete SAP action

  4. Save your logic app.

Test your logic app

  1. If your logic app isn't already enabled, on your logic app menu, choose Overview. On the toolbar, choose Enable.

  2. On the Logic App Designer toolbar, choose Run. This step manually starts your logic app.

  3. Trigger your logic app by sending an HTTP POST request to the URL in your HTTP request trigger, and include your message content with your request. To the send the request, you can use a tool such as Postman.

    For this article, the request sends an IDoc file, which must be in XML format and include the namespace for the SAP action you're using, for example:

    <?xml version="1.0" encoding="UTF-8" ?>
    <Send xmlns="http://Microsoft.LobServices.Sap/2007/03/Idoc/3/ORDERS05//620/Send">
  4. After you send your HTTP request, wait for the response from your logic app.


Your logic app might time out if all the steps required for the response don't finish within the request timeout limit. If this condition happens, requests might get blocked. To help you diagnose problems, learn how you can check and monitor your logic apps.

Congratulations, you've now created a logic app that can communicate with your SAP server. Now that you've set up an SAP connection for your logic app, you can explore other available SAP actions, such as BAPI and RFC.

Connector reference

For technical details about the connector as described by the connectors' Swagger files, see these reference articles:

Get support

Next steps