Classic Integrations Activities
Last updated Jul 17, 2024

Generating a SAP BAPI workflow for versions older than v2.0.0

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, you 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 you to 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 in order to extract 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 the status to Online.

Note: 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 field. Optionally, also enter a description.

Once the SAP BAPI Name field is filled in, 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. 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 if 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.
Note: 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.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.