Skip to main content

Introducing the SAP ERP connector

Headshot of article author Sameer Chabungbam

SAP is one of the largest providers of Enterprise Resource Planning (ERP) software in the market today, handling an enterprise’s business applications like accounting, sales, payroll, finance, production, human resources, etc. We are happy to announce the  public preview of a new SAP ERP connector for Power Apps and Power Automate. The SAP ERP connector allows you to connect your flows and apps to an SAP ERP system – either SAP ECC or SAP S/4HANA. It has the following functionality:

  • Allows you to create a connection to an SAP ECC or S/4HANA Server using either SAP authentication or Windows authentication
  • Allows you to invoke any BAPI and custom RFCs
  • Provides dynamic schemas for the input and output parameters for an RFC or BAPI

In this post, I will walk you through how to get started with using the SAP ERP connector.  SAP systems are inherently complex and many enterprises tend to guard their SAP systems providing access when needed.  Typically, you may need to get help your enterprise IT team’s SAP experts.

The SAP ERP connector can be used from a flow.  To use it from an app, you can invoke those flows from your app.  This abstraction helps in maintaining separation of concern between the complexities for connecting to SAP data, and the app development by Makers in Power Apps.

Pre-requisites

The SAP ECC connector for Microsoft Flow and PowerApps requires the on-premise data gateway as well as the SAP .NET Connector 3.0 SDK from SAP.

  1. Install the latest release of the on-premise data gateway from our download page. Note that you will need the December 2019 release or higher of the on-premise Data Gateway (version: 3000.21.18 or higher).
  2. Download and install SAP .NET Connector 3.0 SDK from SAP. NOTE: Access to the download requires a valid S-user. You may need to reach out to your SAP team. The connector comes in 32-bit and 64-bit versions, and you must choose the 64-bit version.When installing, in the Optional setup steps window, make sure you select the Install assemblies to GAC option as shown in the following image.

Using the connector in flows

To use the SAP ERP connector in Power Automate, login and create a new flow.  You may try using one of the Instant flows – but you could use any trigger. In order to be able to call the flow from an app, you will need to use the Power Apps trigger.

Look for “sap” and you should see the “SAP ERP” connector.  Select the “Call SAP function” action to call your SAP ERP system.

Connecting to SAP

Once you select the SAP ECC action, you will be prompted to create a connection.  You have to specify the following parameters:

  • Authentication Type: SAP Authentication or Windows Authentication
  • Data Gateway: Make sure you select the Data Gateway as defined above and the pre-requisites are installed on the Gateway machine.
  • SAP Username: The username for the SAP account.
  • SAP Password: The password for the SAP account.

For details on the authentication type, you can look up the documentation – esp if you want to use Windows Authentication, which requires additional configuration you need to follow. Once done, click on “Create” to create the connection.

Invoking an SAP function

Once you create the connection, you need to provide the details on the SAP system that you are connecting to and the name of the BAPI or RFC in the ‘SAP function name’ parameter:

  • AS Host: Specify the Application Server host’s name or IP address. Your gateway machine should be able to resolve and connect to the host
  • Client: The SAP Client ID that is used to identify your connection to the SAP system
  • AS System Number: Specify the Application Server’s system number. Typically: 00
  • SAP function name: Specify the SAP BAPI or RFC that you want to invoke

For the ‘Stateful Session’ parameter, set to ‘Yes’ for write operations.  This will commit those writes back to SAP ECC system.  Otherwise, you can set it to ‘No’.

Based on the BAPI or RFC that you select, you may need to provide additional inputs required for your function.

Once you finish the configuration, you can save, and test your flow.  You should be able to leverage the output of the SAP function BAPI or RFC in any subsequent action in your flow.  For example, in the screens below, I used the output to create a HTML table which I am using to send an email myself.

Using the connector in an app

To use the connector from an app, you will need to create a flow with a Power Apps trigger as described above and then, use the flow in your app.  This is illustrated in this documentation.

If you need to return data back to your app, you need to add an additional step in your flow. There are couple of ways of doing that. First, you can use the “Respond to PowerApps” action as described in this blog. But, this works if you intend to return simple structured data to your app. For most SAP scenaraios, this is not likely the case.

The other mechanism, which you can read in this blog, is to use the HTTP “Response” action. This is preferred if your data structure is complex. However, you need to provide the response schema as well, since the HTTP method has no way of knowing the structure of the response data. Thankfully, you can fully generate the response schema from a sample run.

After you have created your flow to invoke SAP, run the flow and copy the data that you want to return to your app.  For example, you can return the entire response body, or you can return a specific field/property.  Whatever you select, make sure that the select the right property in the next step.

Next, add the “Response” action in your flow.

In the Response action, select the data you want to respond to your PowerApps.  Make sure that you select the right property field.

Next, you need to define the schema for the response data.  We will use a sample payload to generate the schema for us.  Click on “Use sample payload to generate schema”, copy paste the sample data you copied in the previous step and click Done.


You will now have the response schema generated for you.

Save your flow.  It is a good idea to test your flow to see if things are working.  You can now follow the rest of steps in the blogs above, or the documentation to use those flows from your app.

Feedback

This has been one of the big asks we have had from our customers.  If you have any feedback or doing something interesting with the connector, we would like to know.  We intend to add more features and make this connector generally available as well.  Your feedback will go a long way in shaping how the connector evolves.  You can write to us at sap_ecc_powerapps ( @service.microsoft.com ).