自学内容网 自学内容网

PyRFC 适用于 Python 的异步、非阻塞 SAP NetWeaver RFC SDK 绑定

Asynchronous, non-blocking SAP NetWeaver RFC SDK bindings for Python.
适用于 Python 的异步、非阻塞 SAP NetWeaver RFC SDK 绑定

PyRFC 适用于 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

Requirements

SAP NW RFC SDK 7.50 Patch Level 12

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

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

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)!