Calling SAP BAPIs from Google Sheets

Integrating external systems into Google Sheet can be done through the AppScript system available through the “script editor”.

A prerequisite for this tutorial is a Callable instance which is already connected to an SAP system. In this case, we are using a Google Cloud Run hosted runtime to make API calls available.

Starting with an empty Sheet

Starting with an empty sheet, you need to open the script editor through the “tools -> Script editor” menu entry.

Google Sheets empty sheet

Google Sheets empty script editor

Script for API invocation

The full AppScript can be downloaded from the following GitHub gist. You just need to paste the script into the editor window and save the project.

The endpoint still needs to be replaced with your endpoint.

Google Sheets script pasting

Calling a BAPI within Sheets

After navigating back to the sheet, you can invoke the function with the parameters for rfcName and payload.

=invokeRFC("BAPI_FLIGHT_GETLIST")

Google Sheets BAPI call

Google Sheets BAPI loading

Google Sheets BAPI data

With the second parameter, you can control, how the BAPI is called. The BAPI_FLIGHT_GETLIST BAPI, for example, supports filtering by arbitrary criteria.

Google Sheets filtered data

That is it for now. If you need more integration let us know under contact@callable.cloud.

callable.cloud

SAP integration just a container away!

Powered by APImeister Consulting GmbH (imprint)