SAP BAPI package - The SAP BAPI package contains actions to automate tasks and processes using SAP Business Application Programming Interface ( SAP BAPI ). BAPI is a standardized method that enables a third-party application to interact with an SAP system.

Automation 360

The SAP BAPI package contains actions to automate tasks and processes using SAP Business Application Programming Interface (SAP BAPI). BAPI is a standardized method that enables a third-party application to interact with an SAP system.

Overview

Business Application Programming Interfaces (BAPIs) are APIs that enable external applications to access SAP business objects.

Typically, a BAPI consists of the following parameters:

  • Import parameters: Used to receive data from the calling applications.
  • Export parameters: Used to return data to the calling application.
  • Import/export table parameters: Tables used for both receiving data and returning data.

A parameter can be of the following type:

  • Data element: Scalar data type
  • Structure: Typically contains multiple fields

    If an import parameter is of the type structure, you can pass multiple values as key-value pairs.

  • Table: A data structure that contains more than one row

For a BAPI method to work, the calling application can call the method in a BAPI using the following:

  • BAPI name
  • Import parameters (scalar, structure, table)
  • Export parameters (scalar, structure, table)

The following is the high level workflow of creating automation using SAP BAPI package:

  1. Use the Connect action to establish a connection with the SAP application.
  2. Use the Create function action to create a user-defined function for the specified SAP BAPI function.

    Select the Begin sequence option to mark the start of a process followed by the actions to automate a task.

  3. Use the Run function action to run the function you have created using the Create function action.

    Select the End sequence option to mark the end of a process and the Commit transaction option to commit the changes.

Prerequisites

Download the SAP Java connector (SAP JCo) library from SAP Java Connector. Contact your SAP accounts administrator, mentioning the operating system and processor, to download the file.

You can extract the SDK files and store them on your local desktop or upload them to the Control Room.

The Connect action requires the following files from the SDK package to establish connection to a SAP system:

  • sapjco3.jar
  • sapjco3.dll for Windows automation
  • libsapjco3.dylib for macOS automation

Actions in the SAP BAPI package

The SAP BAPI package contains the following actions:

Action Description
Connect The Connect action establishes the connection to an SAP system. Using Connect action for SAP BAPI.
Create function The Create function action creates an alias for a SAP BAPI function and saves it with an alias name. Create function action.
Get field value The Get field value action obtains data of a specific field from a function, table, or structure. Get field value action.
Get structure The Get structure action obtains data from a structure using the function alias. Get structure action.
Get table The Get table action retrieves tabular data from a table using the function alias. Get table action.
Run function The Run function action executes the SAP BAPI function. Run function action.
Set field value The Set field value action sets data into a function, table, or structure using the function alias. Set field value action.
Run standard workflow The Run standard workflow action runs a standard workflow in SAP BAPI. Run standard workflow action.
Run custom workflow The Run custom workflow action runs a custom workflow in SAP BAPI. Run custom workflow action.

Build sample bots using the SAP BAPI package

If you are getting started with the SAP BAPI package, a good place to start is to build some sample bots with the help of the following tutorials. The tutorials are intended to train you on how to use various actions from the SAP BAPI package to invoke SAP BAPIs, pass import parameters, and retrieve data from export parameters.
  • Example of using Get structure command from SAP BAPI package: In this tutorial, you will build a that invokes BAPI_FLIGHT_GETLIST from the SAP demo Flight Data application. When executed, the calls the BAPI function by inputting an airline ID and destination details, gets a list of flights, and writes the response data to a CSV file.
  • Example of writing data to SAP using SAP BAPI package: In this tutorial, you will build a that invokes BAPI_FLCUST_CREATEFROMDATA from the SAP demo Flight Data application. You will use the CUSTOMER_DATA import parameter to pass the customer data to the BAPI. When executed, the creates a new customer record in SAP database and displays the customer number returned by the BAPI.
  • Example of using Run standard workflow from SAP BAPI package: In this tutorial, you will build a bot that uses a single action to select a BAPI from a list of function modules, to set import parameters, and to get the response data. When executed, the bot gets flight availability data based on the input data, and writes it to a CSV file.