Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Python bindings for SAP NetWeaver RFC Library (libsapnwrfc)

Project Description

pyrfc package provides Python bindings for SAP NetWeaver RFC Library, for a comfortable way of calling ABAP modules from Python and Python modules from ABAP, via SAP Remote Function Call (RFC) protocol.

Platforms & Prerequisites

The pyrfc can be used with Python 2.6, 2.7 and 3.3+, on Linux and Windows 64 and 32 bit platforms.

OS X and ARM platforms are currently not supported, as SAP NW RFC Library is not available for those platforms.

To start using pyrfc you need to obtain SAP NW RFC Library from SAP Service Marketplace, following these instructions .

A prerequisite to download is having a customer or partner account on SAP Service Marketplace and if you are SAP employee please check SAP OSS note 1037575 - Software download authorizations for SAP employees.

SAP NW RFC Library is fully backwards compatible, supporting all NetWeaver systems, from today, down to release R/3 4.0. You can therefore always use the newest version released on Service Marketplace and connect to older systems as well.

Installation & Documentation

For details on installation and usage, please refer to pyrfc documentation, complementing SAP NW RFC Library Programming Guide and Documentation, from SAP Service Marketplace.

Usage examples

In order to call remote enabled ABAP function module (ABAP RFM), first a connection must be opened.

>>> from pyrfc import Connection
>>> conn = Connection(ashost='', sysnr='00', client='100', user='me', passwd='secret')

Using an open connection, we can invoke remote function calls (RFC).

>>> result ='STFC_CONNECTION', REQUTEXT=u'Hello SAP!')
>>> print result
{u'ECHOTEXT': u'Hello SAP!',
u'RESPTEXT': u'SAP R/3 Rel. 702   Sysid: ABC   Date: 20121001   Time: 134524   Logon_Data: 100/ME/E'}

Finally, the connection is closed automatically when the instance is deleted by the garbage collector. As this may take some time, we may either call the close() method explicitly or use the connection as a context manager:

>>> with Connection(user='me', ...) as conn:
    # connection automatically closed here

Alternatively, connection parameters can be provided as a dictionary, like in a next example, showing the connection via saprouter.

>>> def get_connection(connmeta):
...     """Get connection"""
...     print 'Connecting ...', connmeta['ashost']
...     return Connection(**connmeta)

>>> from pyrfc import Connection

>>> SAPROUTER = '/H/'

>>> TEST = {
...    'user'      : 'me',
...    'passwd'    : 'secret',
...    'ashost'    : '',
...    'saprouter' : SAPROUTER,
...    'sysnr'     : '00',
...    'client'    : '100',
...    'trace' : '3', #optional, in case you want to trace
...    'lang'      : 'EN'
... }

>>> conn = get_connection(TEST)
Connecting ...

Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pyrfc-1.9.562.tar.gz (580.3 kB) Copy SHA256 Checksum SHA256 Source Nov 15, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting