PyRFC 适用于 Python 的异步、非阻塞 SAP NetWeaver RFC SDK 绑定
Asynchronous, non-blocking SAP NetWeaver RFC SDK bindings for Python.
适用于 Python 的异步、非阻塞 SAP NetWeaver RFC SDK 绑定
Call for Maintainers
This project is currently looking for new maintainers. Please see this issue for details.
Features
- Client 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
- Throughput monitoring
Supported platforms
-
All platforms supported by SAP NWRFC SDK are supported by build from source installation (build instructions)
-
In addition, pre-built wheels are provided for Windows, Darwin and Ubuntu Linux, attached to PyRFC GitHub release
-
Docker containers: SAP fundamental-tools/docker
-
Linux wheels supported by build from source installation only
-
Pre-built portable Linux wheels
-
are not supported, neither issues related to portable Linux wheels
-
must not be distributed with embedded SAP NWRFC SDK binaries, only private use permitted
-
-
Microsoft IIS, see #359
Requirements
SAP NW RFC SDK 7.50 Patch Level 12
- see SAP Note 3337381: SAP NetWeaver RFC SDK 7.50 -- Patch Level 12 for a list of bug fixes and enhancements made with this patch release.
- Only the latest patch level is supported by SAP
- The latest version is fully backwards compatible, from today S4, down to R/3 release 4.6C.
- Can be downloaded from SAP Software Download Center of the SAP Support Portal, like described at SAP NetWeaver Remote Function Call (RFC) Software Development Kit (SDK).
- If you are lacking the required authorization for downloading software from the SAP Service Marketplace, please follow the instructions of SAP Note 1037575 for requesting this authorization.
Linux
PyRFC is using source distribution (sdist) installation on Linux systems and Cython is required on Linux system to build the PyRFC package from source. See Installing Cython
Windows
-
Visual C++ Redistributable Package for Visual Studio 2013 is required for run-time, see SAP Note 2573790 - Installation, Support and Availability of the SAP NetWeaver RFC Library 7.50
-
Build toolchain for Python requires Microsoft C++ Build Tools, the latest version recommended
-
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
-
Remote paths must be set in SAP NWRFC SDK for macOS: documentation
-
When the PyRFC is started for the first time, the popups may come-up for each NWRFC SDK library, to confirm the usage. If SAP NW RFC SDK is installed in admin folder, the app shall be first time started with admin privileges, eg.
sudo -E
Docker
- Docker container examples for Linux, Intel and ARM based Darwin: SAP/fundamental-tools/docker. SAP NWRFC SDK libraries are not included.
Getting started
Note: The package must be installed before use.
Call ABAP Function Module from Python
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')
# 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" ...}]
原文地址:https://blog.csdn.net/dwjnhkbc123/article/details/142371466
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!