Can SAP work with Python?

岁酱吖の 提交于 2019-12-03 04:14:40

问题


Can Python be used to query a SAP database?


回答1:


Python SAP RFC module seems inactive - last (insignificant ) commit 2 years ago - but may serve you:

Pysaprfc is a wrapper around SAP librfc (librfc32.dll on Windows, librfccm.so or librfc.so on Linux). It uses the excellent ctypes extension package by Thomas Heller to access librfc and to define SAP compatible datatypes.

Modern SAP versions go the Web Service way - you could build a SAP Web Service and consume it from Python.

With SAP NetWeaver, developers can connect applications and data sources to integrate processes using Web services.

In particular, developers can use one infrastructure to define, implement, and use Web services in an industry standards based way. SAP NetWeaver supports synchronous, asynchronous, stateful and stateless web service models - enabling developers to support different integration scenarios.

sapnwrfc supports this SAP NetWeaver functionality, supersedes the older RFC SDK, and is actively maintained.




回答2:


Python RFC connector is now available as open source: PyRFC




回答3:


If you're talking about (what used to be named) the SAP Database AKA SapDb, and is now MaxDB (for a while distributed also by MySql Inc, now again by SAP only -- and so named SAP MaxDB), it comes with several Python access modules, documented here.

This is the only meaning I can attach to "SAP as the database engine" -- that you want to access SAP MaxDB. Other answers make different assumptions and (I believe) are also correct... under those different assumptions.




回答4:


Sap is NOT a database server. But with the Python SAP RFC module you can query most table quite easily. It is using some sap unsupported function ( that all the world is using). And this function has some limitation on field size and datatypes.




回答5:


SAP now has a Python RFC connector called pyrfc. This supersedes sapnwrfc.

This can be found at: https://github.com/SAP/PyRFC

"The pyrfc Python 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."




回答6:


As stated above, when you just want to read tables or do RFC or BAPI calls, you can use CPython with the unmaintained Python SAP RFC module or Piers Harding's SAP RFC. The RFC calls to just read a table are RFC_GET_TABLE_ENTRIES or RFC_READ_TABLE, where the former is preferred, but also not released to customers.

For a more official way, you can use SAP's JCO connector with Jython or SAP's .Net Connector with Ironpython; both connectors can be downloaded from SAP's service marketplace and both allow to call the RFC functionality including the two calls listed above.

As also stated above, the way proposed by SAP to access backend functionality is via SAP's vast SOA infrastructure. Here you can use Jython with e.g. the Axis library or Ironpython with Microsofts WCF. Note, that the services provided by SAP obviously won't allow you to access the plain tables, instead you just can call, what a service provides. SAP already delivers about 3.000 services (see the ES Wiki on SDN), and creating your own service is in fact dead simple, once you have your business logic in a remote-enabled function module.



来源:https://stackoverflow.com/questions/1466917/can-sap-work-with-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!