从Python 查询SAP 数据库?

发布于 2024-08-05 19:21:52 字数 1431 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

凑诗 2024-08-12 19:21:52

Python SAP RFC 模块 似乎不活动 - 最后一次(无关紧要的)提交 2年前 - 但可能为您服务:

Pysaprfc 是 SAP librfc(Windows 上的 librfc32.dll、Linux 上的 librfccm.so 或 librfc.so)的包装器。它使用 Thomas Heller 优秀的 ctypes 扩展包来访问 librfc 并定义 SAP 兼容的数据类型。

现代 SAP 版本采用 Web 服务 方式 - 您可以构建 SAP Web Service 并通过 Python 使用它。

借助 SAP NetWeaver,开发人员可以连接应用程序和数据源,以使用 Web 服务集成流程。

特别是,开发人员可以使用一个基础架构以基于行业标准的方式定义、实现和使用 Web 服务。 SAP NetWeaver 支持同步、异步、有状态和无状态 Web 服务模型 - 使开发人员能够支持不同的集成场景。

sapnwrfc 支持此 SAP NetWeaver 功能,取代较旧的 RFC SDK,并得到积极维护。

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.

温柔戏命师 2024-08-12 19:21:52

Python RFC 连接器现已作为开源提供:PyRFC

Python RFC connector is now available as open source: PyRFC

禾厶谷欠 2024-08-12 19:21:52

SAP 现在有一个名为 Pyrfc 的 Python RFC 连接器。这取代了 sapnwrfc。

这可以在以下位置找到: https://github.com/SAP/PyRFC

“pyrfc Python 包提供SAP NetWeaver RFC 库的 Python 绑定,通过 SAP 远程函数调用 (RFC) 协议,以一种舒适的方式从 Python 调用 ABAP 模块和从 ABAP 调用 Python 模块。”

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."

银河中√捞星星 2024-08-12 19:21:52

如果您谈论的是(以前的名称)SAP 数据库,又名 SapDb,现在是 MaxDB(一段时间内也由 MySql Inc 分发,现在再次由 SAP 提供 - 并如此命名 SAP MaxDB),它附带了几个Python访问模块,记录此处

这是我可以附加到“SAP 作为数据库引擎”的唯一含义——您想要访问 SAP MaxDB。其他答案做出不同的假设,并且(我相信)也是正确的......在这些不同的假设下。

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.

强辩 2024-08-12 19:21:52

SAP 不是数据库服务器。
但使用 Python SAP RFC 模块,您可以非常轻松地查询大多数表。它正在使用一些 sap 不支持的功能(全世界都在使用)。并且该函数对字段大小和数据类型有一定的限制。

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.

櫻之舞 2024-08-12 19:21:52

如上所述,当您只想读取表格或执行 RFC 或 BAPI 调用时,可以将 CPython 与未维护的 Python SAP RFC 模块或 Piers Harding 的 SAP RFC.仅读取表的 RFC 调用是 RFC_GET_TABLE_ENTRIES 或 RFC_READ_TABLE,其中前者是首选,但也不会发布给客户。

对于更正式的方式,您可以将 SAP 的 JCO 连接器与 Jython 结合使用,或者将 SAP 的 .Net 连接器与 Ironpython 结合使用;这两个连接器都可以从 SAP 的服务市场下载,并且都允许调用 RFC 功能,包括上面列出的两个调用。

如上所述,SAP 提出的访问后端功能的方式是通过 SAP 庞大的 SOA 基础设施。在这里,您可以将 Jython 与 Axis 库一起使用,或将 Ironpython 与 Microsoft 的 WCF 一起使用。请注意,SAP 提供的服务显然不允许您访问普通表,而您只能调用服务提供的内容。 SAP 已经提供了大约 3000 个服务(请参阅 SDN 上的 ES Wiki),一旦您在支持远程的功能模块中拥有业务逻辑,创建您自己的服务实际上非常简单。

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.

北方。的韩爷 2024-08-12 19:21:52

Python 是最常用的面向对象编程语言之一,非常易于编码和理解。

为了在 SAP 中使用 Python,我们需要安装 Python SAP RFC 模块,即 PyRFC。它的可用方法之一是 RFC_READ_TABLE,可以调用它从 SAP 数据库的表中读取数据。

此外,PyRFC 包提供了各种绑定,可用于以任何一种方式进行调用。我们可以使用 ABAP 模块到 Python 模块进行调用,或者反过来。人们可以定义用于数据交换的等效 SAP 数据类型。

另外,我们可以用Python创建Web Service,用于相互通信。 SAP NetWeaver 与全状态或无状态的 Web 服务完全兼容。

Python is one of the most used object-oriented programming languages which is very easy to code and understand.

In order to use Python with SAP, we need to install Python SAP RFC module which is known as PyRFC. One of its available methods is RFC_READ_TABLE which can be called to read data from a table in SAP database.

Also, the PyRFC package provides various bindings which can be utilized to make calls either way. We can use to make calls either from ABAP modules to Python modules or the other way round. One can define equivalent SAP data types which are used in data exchange.

Also, we can create Web Service in Python which can be used for inter-communication. SAP NetWeaver is fully compatible with web services either state full or stateless.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文