如何在 Ruby on Rails 中连接到 SAP

发布于 2024-12-29 03:04:25 字数 185 浏览 3 评论 0原文

我想将信息从 SAP 检索到 Ruby on Rails。

我找到了 这个,但我很困惑如何安装和使用它,有人可以解释一下吗关于?我们将不胜感激。

非常感谢。

I want to retrieve information from SAP to Ruby on Rails.

I found this one, but I'm confused how to install and use it, can someone explain about? It would be appreciated.

Thank you very much.

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

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

发布评论

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

评论(4

九局 2025-01-05 03:04:25

我使用 Piers Harding 编写的库。您需要从 sap 下载 nwrfcsdk 库,然后按照 ruby​​-sapnwrfc 的 README 中所示的安装过程进行操作。

您可以调用远程启用的 sap 功能模块 - 例如 ENQUEUE_READ,如以下简单示例所示:

#!/usr/bin/env ruby

require 'sapnwrfc'
require 'rubygems'

conn = SAPNW::Base.rfc_connect(:client => '100',
                               :sysnr  => '01',
                               :lang   => 'EN',
                               :ashost => 'host',
                               :passwd => 'pw',
                               :trace  => 0,
                               :user   => 'sapuser')

sm12 = Hash.new

# lookup the dictionary definition of an Function Module
fds = conn.discover("ENQUEUE_READ")

# create an instance of a Function call
func = fds.new_function_call
func.GUNAME = ""
func.invoke

cnt = func.NUMBER
if 2000 < cnt
  puts "more than 2000 entries"
end
conn.close

I use the library written by Piers Harding. You need to download the nwrfcsdk library from sap and then follow the installation process as shown in the README of ruby-sapnwrfc.

You can call remote enabled sap function modules - for example ENQUEUE_READ like in the following simple example:

#!/usr/bin/env ruby

require 'sapnwrfc'
require 'rubygems'

conn = SAPNW::Base.rfc_connect(:client => '100',
                               :sysnr  => '01',
                               :lang   => 'EN',
                               :ashost => 'host',
                               :passwd => 'pw',
                               :trace  => 0,
                               :user   => 'sapuser')

sm12 = Hash.new

# lookup the dictionary definition of an Function Module
fds = conn.discover("ENQUEUE_READ")

# create an instance of a Function call
func = fds.new_function_call
func.GUNAME = ""
func.invoke

cnt = func.NUMBER
if 2000 < cnt
  puts "more than 2000 entries"
end
conn.close
夜无邪 2025-01-05 03:04:25

您可以将肥皂与 sap 一起使用,尝试使用此库 Savon

You can use soap with sap, try using this library Savon

匿名。 2025-01-05 03:04:25

你正在运行 JRuby 吗?如果是这样,您可以轻松使用 SAP JCo (SAP Java Connector)< /a> 用于连接到支持 RFC 的功能模块(和 BAPI)。网络上有大量如何使用 SAP JCo 的示例,例如:http:// /www.vogella.de/articles/SAPJCo/article.html

与使用 Savon 的 Web 服务调用相比,这应该简单得多

Are you running JRuby? If so, you can easily use SAP JCo (SAP Java Connector) for connecting to RFC-enabled function modules (and BAPIs). There are tons of examples on the web how to use SAP JCo, like this one: http://www.vogella.de/articles/SAPJCo/article.html.

Compared to a web service call using Savon, this should be much more simple

遗失的美好 2025-01-05 03:04:25

在我们的“Wer liefert was”公司,我们通过 AMQP 总线 使用 JSON REST API。

目标是,我们关闭夜间数据库导入并实现项目的即时更新。

SAP 没有向 AMQP 总线添加消息的本机方法,这一问题已通过 ruby​​ 代理应用程序解决,该应用程序提供了 SAP 在保存项目后可以调用的 REST API。然后,代理应用程序将一条消息添加到 AMQP 总线,该消息由导入器脚本使用。

Rails 应用程序的连接也通过 SAP 系统提供的 REST API 解决。

At our company "Wer liefert was" we connected the SAP Plattform with our Ruby on Rails Stack through a AMQP Bus with JSON REST APIs.

The Goal was, that we switch off our nightly database import and make an instant update of the items possible.

The problem, that SAP has no native method for adding messages to the AMQP Bus, was solved by a ruby proxy app, which provided a REST API that could be called by SAP after a item was saved. The proxy app than added a message to the AMQP bus that was consumed by an importer script.

The connection from our Rails app was also solved with REST APIs that are provided by the SAP System.

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