Integration with SAP via Logic Apps

Loading

Integrating SAP with Azure Logic Apps allows businesses to automate workflows and streamline operations by connecting SAP data with modern cloud services like SharePoint, SQL, Dynamics 365, Outlook, or custom APIs. Microsoft provides a SAP Connector within Logic Apps that supports various integration types, including BAPI, RFC, IDoc, and SOAP.

This detailed, step-by-step guide (~1000 words) will walk you through integrating SAP with Logic Apps and provide insights into authentication, configuration, use cases, and best practices.


Overview

Why Integrate SAP with Logic Apps?

  • Automate SAP transactions (e.g., sales order creation, customer updates)
  • Connect legacy SAP systems with modern cloud-based tools
  • Enable low-code/no-code automation for business users
  • Support hybrid integration scenarios (on-premises SAP ↔ cloud services)

Prerequisites

Before you start, ensure the following:

  1. SAP Environment Access (SAP ECC or S/4HANA)
  2. SAP Gateway or Application Server details
  3. Azure Subscription
  4. SAP credentials with necessary permissions
  5. On-premises Data Gateway (if SAP is not exposed publicly)
  6. Logic Apps Contributor role

Step-by-Step Integration


Step 1: Install On-Premises Data Gateway (Optional)

If SAP is hosted within your internal network:

  1. Download and install On-premises Data Gateway on a machine in your network.
  2. Log in with your Azure credentials.
  3. Configure it under Azure Portal > Logic Apps > Gateways.
  4. Ensure connectivity to SAP is open (ports 33xx, etc.).

Step 2: Create a New Logic App

  1. In Azure Portal, go to Create a Resource > Logic App (Consumption/Standard).
  2. Fill in:
    • Resource Group
    • Logic App name
    • Region
  3. Choose Logic App Designer to create your workflow.

Step 3: Add a Trigger

Choose a trigger depending on your business scenario:

  • Manual Trigger for testing: Start with a blank logic app > "When an HTTP request is received"
  • Recurring Trigger: Recurrence > Every X minutes/hours
  • Event-based Trigger (e.g., SharePoint or SQL insert)

Step 4: Add SAP Action

  1. Click + New Step > Search “SAP”.
  2. Choose “Send message to SAP server” or “Call SAP function”.
  3. Select the appropriate gateway (if on-premises).
  4. Create a SAP connection using:
    • Application Server Host (SAP hostname or IP)
    • Client (e.g., 100)
    • System Number (e.g., 00)
    • SAP User & Password
    • Language (e.g., EN)

Step 5: Call BAPI or RFC Function

  1. In the Function Module Name, input your desired SAP function (e.g., BAPI_SALESORDER_CREATEFROMDAT2, Z_CUSTOM_FUNCTION).
  2. Logic Apps will automatically retrieve input/output parameters.
  3. Map required input fields from previous steps or static values.

Example Input Mapping:

{
"ORDER_HEADER_IN": {
"DOC_TYPE": "OR",
"SALES_ORG": "1000",
"DISTR_CHAN": "10",
"DIVISION": "00"
},
"ORDER_ITEMS_IN": [
{
"MATERIAL": "MAT123",
"TARGET_QTY": "5"
}
]
}

Step 6: Add Further Actions

After the SAP call, you can:

  • Store response in SQL Server or SharePoint
  • Send notification via Outlook or Teams
  • Post a message to Service Bus or Event Grid
  • Log to Application Insights

Step 7: Test and Monitor

  1. Save the Logic App.
  2. Trigger the workflow manually or via schedule.
  3. Check Run History to debug:
    • Input/Output
    • Response from SAP
    • Error messages

Use Case Examples

Use CaseDescription
Order ProcessingCreate a sales order in SAP when a new record is submitted via Power Apps.
Customer Master SyncSync customer details from SAP to Azure SQL.
Purchase Request AutomationTrigger SAP PR creation from SharePoint lists.
Invoice ArchivingSend SAP invoice data to a document library or email inbox.

Best Practices

Secure SAP Credentials

  • Use Azure Key Vault to store SAP passwords securely.
  • Use managed identity for Logic Apps wherever possible.

Error Handling

  • Add “Configure Run After” for failed or timeout actions.
  • Add a Scope block with success/failure branches.
  • Log failures using Log Analytics.

Performance Optimization

  • Use batching or chunking when handling large data volumes.
  • Avoid triggering SAP calls in rapid succession (respect rate limits).

Naming Conventions

  • Prefix steps with meaningful names like Call_BAPI_GetCustomer.
  • Group steps into Scopes for logical organization.

Authentication Considerations

SAP Authentication Methods:

  • Basic Auth (Username/Password) – Common for most BAPIs and RFCs.
  • SAP Certificate Authentication – For higher security (requires setup).
  • Single Sign-On (SSO) – Using Azure AD and SAP Trust configuration.

Ensure:

  • SAP user has permissions for BAPI execution
  • RFC destination is set up in SAP (for Logic Apps IP)

Testing Tips

  • Test BAPIs/RFCs in SAP GUI first with identical parameters.
  • Use Postman to simulate if SAP exposes a REST/OData interface.
  • Start with static inputs and gradually move to dynamic mapping.

Advanced Topics

Use SAP OData with Logic Apps

If your SAP system exposes OData services:

  1. Add a HTTP action in Logic Apps.
  2. Use GET/POST to access the SAP OData endpoint.
  3. Use OAuth or Basic Auth as needed.

This is useful for SAP S/4HANA and Fiori applications.

Combine with Power Automate

  • Trigger Power Automate flows from Logic Apps
  • Use prebuilt SAP connectors in Power Automate for user-based flows

Leave a Reply

Your email address will not be published. Required fields are marked *