Skip to Content
Technical Articles
Author's profile photo Srdjan Boskovic

ABAP RFC connectivity from BTP Python buildpack

ABAP RFC connectivity from BTP to ABAP systems is supported by SAP Cloud Connector, for BTP Java runtime only. This blog describes the RFC connectivity enablement for Python runtime, so that Python BTP applications can consume ABAP RFCs, as described in Deployment options section of Powerful web applications with old and new ABAP systems and related blogs.

Our “hello world” example is BTP Python buildpack, with Flask server, SAP/PyRFC and SAP NW RFC SDK.

The example source code: SAP-samples/node-rfc-samples/integration/pyrfc_btp can be deployed on BTP, or tested locally inside SAP/fundamental-tools/docker/btp_cflinuxfs4.Dockerfile docker container.

ABAP RFC connectivity from Python on Kyma works practically out of the box, using SAP/PyRFC and SAP NW RFC SDK inside docker container. Try SAP/fundamental-tools/docker/cflinuxfs4.Dockerfile for example.


The ABAP RFC enablement of BTP Python buildpack requires the installation of  SAP/PyRFC package and SAP NW RFC SDK registration on BTP host instance. It is similar to RFC enablement of NodeJS buildpack: ABAP RFC connectivity from BTP Node.JS buildpack and Kyma,

Python buildpack structure is shown on figure below



SAP NW RFC SDK files for Linux x64 are copied to app/nwrfcsdk folder and excluded from repository, in .gitignore.

SAP NW RFC SDK is not included in SAP/PyRFC because the license is different. SAP Support Portal is the only allowed public distribution channel for SAP NW RFC SDK.

The nwrfcsdk folder is added to app, to be included in app deployment


include nwrfcsdk
include sapnwrfc.ini

SAP NW RFC SDK home and library paths are added to buildpack manifest.yaml, for build and runtime registration





Local test

cd buildpack/app
pip install pyrfc flask
# do not install from requirements.txt unless your notebook runs on Linux

 * Serving Flask app 'serve'
 * Debug mode: off
 * Running on all addresses (
 * Running on
 * Running on

PyRFC and SAP NW RFC SDK are loaded and PyRFC version shown below


Flask server on


BTP Deployment

cd buildpack
cf push                                                           (py3.11.6) main
Pushing app pyrfcapp to org <redacted> / space dev as <redacted>...
Applying manifest file <redacted>/node-rfc-samples/integration/pyrfc_btp/buildpack/manifest.yaml...

Updating with these attributes...
  - name: pyrfcapp
    path: <redacted>/node-rfc-samples/integration/pyrfc_btp/buildpack/app
    memory: 128M
+   default-route: true
    stack: cflinuxfs4
    command: python
      LD_LIBRARY_PATH: /home/vcap/app/nwrfcsdk/lib
      SAPNWRFC_HOME: /home/vcap/app/nwrfcsdk
    - route:
Manifest applied
Packaging files to upload...
Uploading files...

Instances starting...

name:              pyrfcapp
requested state:   started
last uploaded:     Mon 30 Oct 15:44:40 CET 2023
stack:             cflinuxfs4
        name                                                   version   detect output   buildpack name   1.8.15    python          python

type:            web
instances:       1/1
memory usage:    128M
start command:   python
     state     since                  cpu    memory        disk           logging            details
#0   running   2023-10-30T14:44:56Z   1.1%   31M of 128M   372.2M of 1G   0/s of unlimited

When finished, the test route shows the same result as local test:



Next Steps

Once the RFC connectivity from Python is enabled, the connection parameters for ABAP system shall be configured, as described in Deployment options section of Powerful web applications with old and new ABAP systems and in related blogs

Hope you enjoyed reading and stay tuned for more updates.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.