SAP BAPI package
- Updated: 2024/03/08
SAP BAPI package
The SAP BAPI package contains actions to automate tasks and processes using SAP Business Application Programming Interface (BAPI). BAPI is a standardized method that enables a third-party application to interact with an SAP system.
Overview of SAP BAPIs
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)
Before you start
- Establish a connection with the SAP application using the Connect action.
- 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.
- 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.
Actions in the SAP BAPI package
The SAP BAPI package includes the following actions:
Action | Description |
---|---|
Connect | Using Connect action for SAP BAPI. |
Create function | Create function action. |
Get field value | Get field value action. |
Get structure | Get structure action. |
Get table | Get table action. |
Run function | Run function action. |
Set field value | Set field value action. |
Run standard workflow | Run standard workflow action. |
Run custom workflow | Run custom workflow action. |
Build sample bots using the SAP BAPI package
- Example of using Get structure command from SAP BAPI package: In this tutorial, you will build a bot that invokes BAPI_FLIGHT_GETLIST from the SAP demo Flight Data application. When executed, the bot 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 bot 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 bot 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.