Skip to Content

SAP BAPI execution guide 3.3


This guide describes the process of executing SAP BAPI function modules from Vinyl. What is BAPI?

BAPI technology (Business Application Programming Interface) is the main API technology available to customers to read and update data, that may be called from within SAP or externally using RFC protocol and ALE/IDoc technology (

BAPIs are defined in the SAP Business Object Repository (BOR) as methods of SAP business object types that carry out specific business functions.They are implemented as RFC-enabled function (Remote Function Call) modules and are created in the Function Builder of the ABAP Workbench.

Vinyl requirements

A Vinyl software package including the additional SAP components must be installed on your instance in order to connect with SAP and execute BAPIs. The Vinyl zip file's name will include ThirdPartySAP at the end of the version (i.e. This package has SAP DLLs (Dynamic Link Libraries) in the Vinyl/Bin folder which are necessary in connecting to SAP from Vinyl.

SAP datasource in Vinyl

An SAP datasource in your Vinyl instance linked to the datasource from where you are wanting to call the BAPI is assumed. If you have not set up an SAP datasource, please refer to this documentation and set one up!

Graphical user interface, text, application Description automatically generated

BAPIs in Vinyl

Vinyl utilizes the compilation of local staging tables to pass data to SAP via BAPI execution. Each component of the BAPI function is represented by a staging table and columns that hold values for the corresponding data the module is expecting. In addition BAPI parameters columns, Vinyl relies on defining specific columns which link all the staging tables together during execution.

These Vinyl specific columns are prefixed with '_' and do not get sent to SAP, as their purpose is soley for staging the execution from Vinyl. When the data is staged and ready for BAPI execution, a specific action (which will be clarified below) is called and executes the BAPI with the _id column determining which record set will be passed.


The App Server Database Logs will publish each of the SAP connections and executions, along with BAPI specific parameter data.

Creating local staging BAPI tables

Staging tables can either be created manually or by importing the BAPI structure via the Import Pattern functionality on the SAP data source

If you decide to create the staging tables manually , you should have a proper understanding of the structure and parameters that the BAPI you are wanting to execute has. The structure is crucial in enabling Vinyl to execute the BAPI.

BAPIs can have import parameters (data to be transferred from Vinyl to SAP) and export parameters (data to be transferred from SAP back to Vinyl). BAPIs can have a parent/child structure where the parent component holds the highest level of data and the child component(s) hold a lower level of data. Most BAPIs will also have a /RETURN child component that exports any messages (successful or errors) that will provide confirmation or help the user troubleshoot.

A staging table for both the parent and child components are created in your local data source, where the child table name is prefixed with the parent table name (i.e. parent staging table named BAPI_PO_CREATE1, child staging table named BAPI_PO_CREATE1/POHEADER).

For column creation on the staging table:

  1. Create _id column and set it as UUID data type. Mark as PK and AutoGenerate.

  2. If staging table is a child component, next create _ParentId column and set it as UUID. Define the many to one relationship to the parent table where primary column _Id links to secondary column _ParentId.

  3. Next, if the execution order of the records is critical, add the column _index where an indexing value can be held and referenced during execution.

  4. Next add any local FK columns or useful audit info, prefixed with _, that will help reference the records in your data model to the BAPI table records. (i.e. _POHeaderID will allow us to query BAPI staged data based for a local PO record, _ExecutedOn to track history)

  5. After Vinyl specific columns are added, create all BAPI related columns reflecting the import and export parameters in the function (i.e. PURCHASEORDER, PO_ITEM, DELIVERY_DATE, QUANTITY, etc)

Executing BAPI

To invoke the compliation of staging table data and execution of the BAPI over RFC you will utlize an action on a business object/table's event.

In version 2.7 and higher, there is an Action of Type RFC and four options:





In Vinyl Version 2.6 and earlier, the Action used is of type Plugin and called Execute BAPI and added to the Insert event of a newly created trigger table.

The trigger table can have any name (i.e. BAPITrigger), but the plugin requires specific columns to be defined to reference during execution. These columns are:


  • BAPITriggerID is a newUUID().

  • SourceDataSourceID is the DataSourceID of the local data source where the staging tables live.

  • TargetDatasSourceID is the DatasourceID of the SAP data source where the BAPI will be executed.

  • FunctionModule is the names of the BAPI function modules you are wanting to trigger, separated by commas. (BAPI_TRANSACTION_COMMIT is listed as the last module since it commits the previous BAPI actions.)

  • _Id is the FK to the BAPI staging table and determines which record set will be passed into execution

BAPI function module examples

Below are a few of the many BAPIs that can be executed from Vinyl. The parent component of the BAPI is listed by number and each of the child components are listed below it.

  1. BAPI_PO_CREATE1: Used to create a new PO

  2. BAPI_PO_CHANGE: Used to update values on an existing PO.

  3. BAPI_PO_RELEASE: Used to release a PO after manipulating it.

  4. BAPI_PO_GETDETAIL: Used to retrieve the Header Notes and Text values on the PO.

  5. BAPI_SALESORDER_CREATEFROMDAT2: Used to create Sales Orders

  6. BAPI_CONTRACT_CREATEFROMDATA: Used to create Contracts

  7. BAPI_EXCHANGERATE_GETDETAIL: Used to retrieve currency exchange rates.

  8. Z_ADAPT_DATA_EXTRACT: A custom function used to pull investment plan information.