Skip to main content

Python bindings for SAP NetWeaver RFC SDK

Reason this release was yanked:

No longer supported, see https://github.com/SAP/PyRFC/issues/372

Project description

PyRFC

Asynchronous, non-blocking SAP NetWeawer RFC SDK bindings for Python.

license PyPI - Wheel PyPI - Version PyPI - Python Version PyPI - Downloads REUSE status CII Best Practices

Features

  • Client, Throughput and Server bindings
  • Automatic conversion between Python and ABAP datatypes
  • Stateless and stateful connections (multiple function calls in the same ABAP session / same context)
  • Sequential and parallel calls, using one or more clients

Supported platforms

  • Python 3

  • Windows 10 and macOS >= 10.15 supported by pre-built wheels and build from source installation

  • Linux wheels are supported by build from source installation only

  • Prebuilt Centos wheels are attached to the latest release on GitHub

  • Pre-built portable Linux wheels

    • are not supported, neither issues related to portable Linux wheels

    • :exclamation: must not be distributed with embedded SAP NWRFC SDK binaries, only private use permitted

  • Platforms supported by SAP NWRFC SDK can be supported by build from source

Prerequisites

All platforms

  • SAP NWRFC SDK 7.50 PL3 or later must be downloaded (SAP partner or customer account required) and locally installed

    • Using the latest version is recommended as SAP NWRFC SDK is fully backwards compatible, supporting all NetWeaver systems, from today S4, down to R/3 release 4.6C.
    • SAP NWRFC SDK overview and release notes
  • Build from source on older Linux systems, may require uchar.h file, attached to SAP OSS Note 2573953, to be copied to SAP NWRFC SDK include directory

Windows

:exclamation: Due to a change introduced with Python 3.8 for Windows, PATH directories are no longer searched for DLL. The SAP NWRFC SDK lib path is no longer required on PATH, for Python >= 3.8.

macOS

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode off
  • Remote paths must be set in SAP NWRFC SDK for macOS: documentation

  • When the node-rfc is started for the first time, the popups come-up for each NWRFC SDK library, to confirm it should be opened. If SDK is installed in admin folder, the node-rfc app shall be that first time started with admin privileges, eg. sudo -E

SPJ articles

Highly recommended reading about RFC communication and SAP NW RFC Library, published in the SAP Professional Journal (SPJ)

Installation

pip install pynwrfc

Cython is required on Linux platforms, for the the default build from source installation method.

Build from source can be also requested on Windows and Darwin platforms:

pip install pynwrfc --no-binary :all:
# or
PYRFC_BUILD_CYTHON=yes pip install pynwrfc --no-binary :all:

Alternative build from source installation:

git clone https://github.com/SAP/PyRFC.git
cd PyRFC
python setup.py bdist_wheel
pip install --upgrade --no-index --find-links=dist pynwrfc

See also the pyrfc documentation, complementing SAP NWRFC SDK documentation.

Getting started

Note: The package must be installed before use.

Open Connection

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

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

Connection parameters are documented in sapnwrfc.ini file, located in the SAP NWRFC SDK demo folder.

Call ABAP function modules

Using an open connection, remote function modules (RFM) can be invoked. More info in pyrfc documentation.

# ABAP variables are mapped to Python variables
result = conn.call('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'}

# ABAP structures are mapped to Python dictionaries
IMPORTSTRUCT = { "RFCFLOAT": 1.23456789, "RFCCHAR1": "A" }

# ABAP tables are mapped to Python lists, of dictionaries representing ABAP tables' rows
IMPORTTABLE = []

result = conn.call("STFC_STRUCTURE", IMPORTSTRUCT=IMPORTSTRUCT, RFCTABLE=IMPORTTABLE)

print result["ECHOSTRUCT"]
{ "RFCFLOAT": 1.23456789, "RFCCHAR1": "A" ...}

print result["RFCTABLE"]
[{ "RFCFLOAT": 1.23456789, "RFCCHAR1": "A" ...}]

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:
    conn.call(...)
# connection automatically closed here

Alternatively, connection parameters can be provided as a dictionary:

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

from pyrfc import Connection

abap_system = {
    'user'      : 'me',
    'passwd'    : 'secret',
    'ashost'    : '10.0.0.1',
    'saprouter' : '/H/111.22.33.44/S/3299/W/e5ngxs/H/555.66.777.888/H/',
    'sysnr'     : '00',
    'client'    : '100',
    'trace'     : '3', #optional, in case you want to trace
    'lang'      : 'EN'
}

conn = get_connection(**abap_system)
Connecting ... 10.0.0.1

conn.alive
True

See also the pyrfc documentation, complementing SAP NWRFC SDK documentation.

How to obtain support

If you encounter an issue or have a feature request, you can create a ticket.

Check out the SAP Community (search for "pyrfc") and stackoverflow (use the tag pyrfc), to discuss code-related problems and questions.

Contributing

We appreciate contributions from the community to PyRFC! See CONTRIBUTING.md for more details on our philosophy around extending this module.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pyrfc-2.4.0.tar.gz (260.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyrfc-2.4.0-cp39-cp39-win_amd64.whl (599.7 kB view details)

Uploaded CPython 3.9Windows x86-64

pyrfc-2.4.0-cp39-cp39-macosx_11_0_x86_64.whl (200.8 kB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

pyrfc-2.4.0-cp39-cp39-macosx_10_16_x86_64.whl (201.3 kB view details)

Uploaded CPython 3.9macOS 10.16+ x86-64

pyrfc-2.4.0-cp38-cp38-win_amd64.whl (593.3 kB view details)

Uploaded CPython 3.8Windows x86-64

pyrfc-2.4.0-cp38-cp38-macosx_10_15_x86_64.whl (195.7 kB view details)

Uploaded CPython 3.8macOS 10.15+ x86-64

pyrfc-2.4.0-cp37-cp37m-win_amd64.whl (539.4 kB view details)

Uploaded CPython 3.7mWindows x86-64

pyrfc-2.4.0-cp37-cp37m-macosx_10_15_x86_64.whl (190.1 kB view details)

Uploaded CPython 3.7mmacOS 10.15+ x86-64

pyrfc-2.4.0-cp36-cp36m-win_amd64.whl (537.5 kB view details)

Uploaded CPython 3.6mWindows x86-64

pyrfc-2.4.0-cp36-cp36m-macosx_10_15_x86_64.whl (199.6 kB view details)

Uploaded CPython 3.6mmacOS 10.15+ x86-64

File details

Details for the file pyrfc-2.4.0.tar.gz.

File metadata

  • Download URL: pyrfc-2.4.0.tar.gz
  • Upload date:
  • Size: 260.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for pyrfc-2.4.0.tar.gz
Algorithm Hash digest
SHA256 76f4dbc3f57443f5c0c85bee5795d2d888349df8249672d46569e8ff19503c2a
MD5 b452810a175f84dc8534538d6a71884d
BLAKE2b-256 de1989a2e3f82a9fc03eb4aa97579776166b7601585ab7d8fba4533399bb46ec

See more details on using hashes here.

File details

Details for the file pyrfc-2.4.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pyrfc-2.4.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 599.7 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0

File hashes

Hashes for pyrfc-2.4.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1d2496106bfcdca56b13d96573898a78eb1193ce18163eef0eab217603c0f606
MD5 8ce0d2978ee13fd2e2b9232c58219a85
BLAKE2b-256 68cc1e2be2058e2647a2bcabe91e536e3d10cd79e256aeed0f2fe474b682b548

See more details on using hashes here.

File details

Details for the file pyrfc-2.4.0-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

  • Download URL: pyrfc-2.4.0-cp39-cp39-macosx_11_0_x86_64.whl
  • Upload date:
  • Size: 200.8 kB
  • Tags: CPython 3.9, macOS 11.0+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for pyrfc-2.4.0-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 01c8a126b82c7641bc80507b7e5e5137fc07294f805fcfb2b7f44f891acad366
MD5 51f7e1260fc0e468fef97586c4f7749d
BLAKE2b-256 36a65caaac60e305e2048488a154d93c7202a0e45cadd1dc97d9b80821a2b99e

See more details on using hashes here.

File details

Details for the file pyrfc-2.4.0-cp39-cp39-macosx_10_16_x86_64.whl.

File metadata

  • Download URL: pyrfc-2.4.0-cp39-cp39-macosx_10_16_x86_64.whl
  • Upload date:
  • Size: 201.3 kB
  • Tags: CPython 3.9, macOS 10.16+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.6.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for pyrfc-2.4.0-cp39-cp39-macosx_10_16_x86_64.whl
Algorithm Hash digest
SHA256 ff39d25fc79e1120805c5d19bc49ab7ac3939d3a3cf69d81a924595320b205d7
MD5 ddf32257bff38d985ce5575795d98bf6
BLAKE2b-256 e2ac011779c5c4bb860a7f4894996629ac8d13949072cfdf594ee34738817098

See more details on using hashes here.

File details

Details for the file pyrfc-2.4.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pyrfc-2.4.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 593.3 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0

File hashes

Hashes for pyrfc-2.4.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 32ec1ec68c60fbd493eb87d85baa5dfe2edc5ff07a9b878903e955f31443a7f6
MD5 1ee7db49221df4830bd18183c7b579f8
BLAKE2b-256 0b416432d52c85637b5c4fd0b0a7389bb881fae5803d46a3893a7f1779888113

See more details on using hashes here.

File details

Details for the file pyrfc-2.4.0-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: pyrfc-2.4.0-cp38-cp38-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 195.7 kB
  • Tags: CPython 3.8, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.6.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for pyrfc-2.4.0-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 d93d63bf92fa9e6cb20a2c2845ff07bbb700334e06b916bbf0b6d9039a6b8f70
MD5 516e125d7e16f9f179bec5cada8af241
BLAKE2b-256 9fcdffcd2aabf7d9ae3f834c3ed38f72c47208d8a80a92c8a66cb5acfbee9052

See more details on using hashes here.

File details

Details for the file pyrfc-2.4.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pyrfc-2.4.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 539.4 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0

File hashes

Hashes for pyrfc-2.4.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 984950e0772def00105c8cd97ae1f299725c414673594ac0dbe13249bd76870a
MD5 2819fa913022ab429f7a6cde4ef8a15d
BLAKE2b-256 d5d9335ec316e355b1f9e0749f5985af4365784685bfd79aade36595b655ef0b

See more details on using hashes here.

File details

Details for the file pyrfc-2.4.0-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: pyrfc-2.4.0-cp37-cp37m-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 190.1 kB
  • Tags: CPython 3.7m, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.6.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for pyrfc-2.4.0-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 065488464500a6ec5bd7fb327142865028b56af1b4283439139295cc56b9abc2
MD5 cc99b7d218783fd0d7f0cc60784b215e
BLAKE2b-256 a9fc531e5a5158299bb7d6e323f8d75964f7f78eaff74bd1aff2450fc4dea627

See more details on using hashes here.

File details

Details for the file pyrfc-2.4.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: pyrfc-2.4.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 537.5 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0

File hashes

Hashes for pyrfc-2.4.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 6e60a4e1d63de9ed7d6ecf1778e6d6577e55856b54637df59ac1b45e656b5f6e
MD5 4bc89e4d2161ac59de499c54019678b5
BLAKE2b-256 c73bd92a3436705ab07adb6ac285b87c205738006b0a802215ff383d544efdf2

See more details on using hashes here.

File details

Details for the file pyrfc-2.4.0-cp36-cp36m-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: pyrfc-2.4.0-cp36-cp36m-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 199.6 kB
  • Tags: CPython 3.6m, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.6.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for pyrfc-2.4.0-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 8dedff98003b2cc43cc655a58068f86ee8ffeefcb1c989889249929af71bc6ba
MD5 800836fbb227605a7f3e0c4d2dddf983
BLAKE2b-256 d75bfe98ac3d1aadede56ef39499123f58c9ccab969c54360e89f6e1b8930f93

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page