SAP BAPI
The SAP BAPI connector allows you to integrate your flow with SAP ERP through Business Application Programming Interfaces (BAPIs), which are standardized functions for accessing business processes and data in the SAP system.
In other words, a BAPI is like an "official gateway" that SAP provides so that external systems can query or manipulate data and processes without needing to directly access internal tables or write ABAP code.
What you can do:
-
Query data
-
Retrieve information about customers, suppliers, materials, sales orders, inventory, etc.
Example:
BAPI_CUSTOMER_GETDETAILreturns complete customer data.
-
-
Create records
-
Insert new business data into SAP.
Example:
BAPI_SALESORDER_CREATEFROMDAT2creates a sales order.
-
-
Update records
-
Modify existing data.
Example:
BAPI_EMPLOYEE_CHANGEupdates employee data.
-
-
Execute business operations
-
Trigger internal SAP processes (release documents, perform calculations, generate accounting entries).
Example:
BAPI_GOODSMVT_CREATErecords an inventory movement.
-
-
Test connection and availability
-
Validate if SAP is responding.
Example:
STFC_CONNECTION(returns system information, client, user, etc.).
-
Statement structure (syntax)
Communication with this connector uses a specific key-value structure to map BAPI parameters.
-
Command: always starts with
CALL FUNCTION <BAPI_NAME>. -
Parameters: are defined after the colon ":".
-
Groupings
-
Parentheses ( ): enclose a single key-value pair or an object.
-
Brackets [ ]: enclose lists of items or multiple parameters.
-
-
Syntax
CALL FUNCTION BAPI_NAME: [ (PARAMETER_1: VALUE), (TABLE: [ (FIELD: VALUE) ]) ]
Examples
Check out examples of statements for the SAP BAPI connector:
Connectivity validation
-
Statement
In the statement below, the SAP BAPI connector calls the
STFC_CONNECTIONfunction in SAP. This function is a standard SAP BAPI, used to test connectivity between the client system (in this case, Sensedia Integrations) and the SAP server.CALL FUNCTION STFC_CONNECTION: []
The brackets [] indicate that no additional parameters were passed in the call. -
Return (log)
-
The log excerpt shows the successful execution of the SAP BAPI connector when calling the
STFC_CONNECTIONtest function. -
SAP responded to the request confirming the connection with information about system, client, user and date/time.
-
HTTP status 200 ensures there was no integration error.
{ "message": { "payload": "{\"STFC_CONNECTION\":{\"INPUT\":{\"REQUTEXT\":\"\"},\"OUTPUT\":{\"ECHOTEXT\":\"\",\"RESPTEXT\":\"SAP R/3 Rel. 740 Sysid: ERQ Date: 20250912 Time: 130104 Logon_Data: 300/APISENSEDIA/E\"}}}", "status": 200 } }Read about log details.
-
Table reading
-
Statement
The statement below reads the first 5 rows of table T001 in SAP, returning only the BUKRS and BUTXT fields, separated by semicolons.
CALL FUNCTION RFC_READ_TABLE: [ (IMPORTING: [ (QUERY_TABLE: T001), (DELIMITER: ;), (ROWCOUNT: 5) ]), (TABLES: [ (FIELDS: [ (FIELDNAME: BUKRS), (FIELDNAME: BUTXT) ]) ]) ] -
Statement parts
-
FUNCTION RFC_READ_TABLE: defines that the table reading function will be executed.
-
IMPORTING: contains simple input parameters that configure the function call.
-
QUERY_TABLE: T001: indicates the table to be queried (T001, which contains information about Company Codes). -
DELIMITER: ;: defines that returned fields will be separated by semicolons. -
ROWCOUNT: 5: limits the return to the first 5 rows of the table.
-
-
TABLES: defines parameters in table format, used to send or receive lists of records.
-
FIELDS: specifies the table fields that should be returned (if omitted, returns all columns, which can cause slowness or memory overflow).-
BUKRS: company code (Company Code). -
BUTXT: company description (Company Name).
-
-
-
-
Return (log)
Check two excerpts from the response payload recorded in the logs:
-
INPUT: shows query parameters: queried table, maximum number of records, delimiter and additional options.
{\"INPUT\":{\"QUERY_TABLE\":\"T001\",\"ROWCOUNT\":5,\"GET_SORTED\":\"\",\"NO_DATA\":\"\",\"USE_ET_DATA_4_RETURN\":\"\",\"ROWSKIPS\":0,\"DELIMITER\":\";\"} -
DATA (excerpt): brings the values returned from the query.
DATA\":{\"item\":[{\"WA\":\"300;0001;SAP Brazil ;Sao Paolo ;BR ;BRL ;P;INT ;10;K4;2;000001; ; ; ; ; ; ; ;00000000;2; ; ; ; ;0001; ; ; ;X; ; ; ; ; ; ; ; ; ; ; ;0001; ;0001;0001; ; ;0001; ; ; ; ; ;IE;SE;1; ;X;X; ; ;FMRE; ; ;0; ; ; ; ; ; ; ; ; ; ; ; ; ; ;\"}In this example:
-
The WA (Work Area) field brings data concatenated by the chosen delimiter
-
300: MANDT (SAP Client)
-
0001: BUKRS (Company Code)
-
SAP Brazil: BUTXT (Company Name)
-
Sao Paolo: ORT01 (City)
-
BR: LAND1 (Country)
-
BRL: WAERS (Currency)
-
-
Possible configuration errors
Below we list some common errors that may occur when using the SAP BAPI connector and recommended solutions.
-
Error calling BAPI function in SAP: generic execution error.
-
Verify if the configured user has access permission (object
S_TABU_DIS) to the requested table or execution permission on the BAPI. -
Check if the field names in
FIELDSexist in the table.
-
-
Empty return (DATA: []): no records match the criteria defined in
OPTIONS.-
Check if the date is in YYYYMMDD format.
-
Verify if the values are in uppercase, as SAP is case-sensitive for data.
-
-
ROWCOUNT ignored: SAP returned more rows than requested.
This occurs in certain versions of the function module when there is no primary index in the filter. -
Apply a script component or filter in your flow to eliminate excess rows.
-
Share your suggestions with us!
Click here and then [+ Submit idea]