UiPath Activities Guide

About the SAP BAPI Activities Pack

The SAP BAPI Activities pack enables RPA developers to invoke a SAP Business Application Programming Interface (BAPI) by using a workflow. The package comes with a SAP Connector Wizard that enables the user to generate a workflow for the selected BAPI. This workflow can be invoked from any automation process by use of the Invoke Workflow File activity. The pack contains two activities, Open SAP Connection and Close SAP Connection, which manage the connection to the SAP Instance.

Installation Prerequisites

The 32bit (x86) .NET 4.0 Variant of the SAP Connector for Microsoft .NET 3.0 (NCo 3.0) is a prerequisite for this activity pack. This connector also requires the Microsoft C++ Runtime DLLs version 10.0 (this is contained in the Microsoft Visual C++ 2010 Redistributable Package). Your SAP Administrator should be able to provide the installer.


Please note that the SAP Connector for Microsoft must be installed in the Windows Global Assembly Cache (GAC) to work properly. This can be done by selecting the appropriate option during the installation of the SAP Connector.

These dependencies need to be installed on any machine on which you want to use this activity pack. This refers to both development machines, where workflows are created in Studio, as well as production machines, where the Robot executes such workflows.


All SAP users that want to use the connector are required to be licensed under a respective solution or component license from SAP.

The official documentation of the SAP .NET Connector can be found here.

Generating a SAP BAPI Workflow

After the SAP BAPI package has been installed, the SAP Connector wizard becomes available in UiPath Studio, in the Design ribbon tab, in the Wizards section.

First, we must create a workflow that establishes a connection to the SAP system. After this step is performed, you can invoke multiple BAPI workflows before closing the connection.

The wizard contains 4 sections, as follows:

Login Credentials

This section requires that you enter the System Connection Parameters and Login Information.

For the System Connection Parameters, enter the details of the SAP system you want to connect to for extracting the BAPI information. The required fields are:

  • Application Server Host
  • System Number

For the Login Information, enter the details for the SAP User that is authorized to connect to the above SAP system. The required fields are:

  • Client
  • User
  • Password

You can also specify the language of the SAP system by filling in the Language field. Please note that this field should be filled in with a language code (e.g. EN, DE, etc.). The specified language should be installed on the SAP instance you are connecting to. If no language is specified in this field, the default language of the SAP system is used.

Clicking Connect indicates if the connection was successful and changes status to Online.


If the connection cannot be established, an error message appears. Review and fix the System Connection Parameters or Login Information and retry. If a connection cannot be established successfully, check with your SAP Administrator.

The SAP BAPI Wizard keeps the System Connection Parameters and Login Information values (with the exception of the Password field) for the ongoing Studio session.

Choose BAPI

Enter the name of the BAPI to automate in the SAP BAPI Name. Optionally, also enter a description.

Once the SAP BAPI Name field is filled in and you click Next, If the BAPI is found in the repository, then the Wizard navigates to the Arguments screen.

If the BAPI is not found, an error message appears, informing you of this. Please check that the SAP BAPI name you entered is correct and is enabled in the SAP system. Your SAP Administrator should be able to assist if the BAPI cannot be found.

Select Arguments

The Wizard lists all the arguments for the BAPI, along with the details for each argument such as Direction (In, Out, In/Out), Data Type, and if the argument is Mandatory. Select the arguments that you want to be mapped into the workflow. Arguments marked as Mandatory are always selected for mapping.

You can also specify an Assigned Name to be used for the Workflow Argument in place of the Technical Name from the SAP BAPI.

If a BAPI includes complex arguments, such as tables and structures, which in turn contain complex arguments, an Unsupported BAPI exception is thrown. This happens in the cases of the following argument types:

  • A table within a table.
  • A table within a structure.
  • A structure within a structure.
  • A structure within a table.

An error is also thrown in the case where a BAPI includes the return argument with a parameter type different than BAPIRETURN, BAPIRETURN1, BAPIRET1, BAPIRET2,BAPIRET2_FIX`.

Clicking Next navigates to the Generate Workflow screen.

Generate Workflow

This screen enables you to review the details of your workflow, ensuring you have selected all the arguments that are to be mapped.

The Workflow File Path property field specifies where you want the workflow to be saved.

Clicking Generate creates an .xaml file at the specified path, with all the options selected in the Select Arguments screen.

Invoking the BAPI Workflow

The Invoke Workflow File activity can be used to invoke the SAP BAPI workflow. The Open SAP Connection activity must be placed before the invoke activity, as it generates a SAPConnectionService variable, which is subsequently used in the SAP BAPI workflow argument named SAPConnectionService. This argument should be set in the SapConnectionService property field of the Open SAP Connection activity.


Workflows generated with the SAP BAPI pack cannot be invoked when using the Isolated property in the Invoke Workflow File activity.

Any Table type arguments in the BAPI are mapped to DataTable arguments and any Structure type arguments in the BAPI are mapped to DataRow arguments. All other arguments are mapped to basic data types.

Every BAPI Workflow also returns an argument containing the BapiReturn structure of the appropriate type.

After the Invoke Workflow File activity, a Close SAP Connection activity must be used to close the connection to SAP. The connection can be specified by using the same SAPConnectionService variable.