从 Java 程序打开 SAP GUI 胖客户端屏幕

发布于 2024-08-11 16:42:29 字数 484 浏览 10 评论 0原文

安装 SAP Logon 等任何胖客户端后,用户可以连接到所需的 SAP 服务器并通过事务访问数据。

我正在尝试调用安装在用户计算机中的 SAP GUI 胖客户端,并将用户直接从服务重定向到所需的事务(依次是 Java 代码)。

可以根据生成的 ID 从 SAP GUI 快捷方式执行相同的操作。以下链接将有所帮助 -

http://wiki.sdn.sap.com/wiki/display/Snippets/Creating+a+SAP+shortcut+for+any+transaction+and+sending+it+by+ mail

是否可以通过Java代码执行相同的操作?

Having any thick client like SAP Logon installed, users can connect to required SAP server and access data through transactions.

I am trying to invoke the SAP GUI thick client installed in the user's machine and redirect the user directly to required transaction from the service (in turn Java code).

It is possible to do the same from SAP GUI Shortcuts, based on generated IDs. The following link will help -

http://wiki.sdn.sap.com/wiki/display/Snippets/Creating+a+SAP+shortcut+for+any+transaction+and+sending+it+by+mail

Is it possible to do the same through Java code?

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

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

发布评论

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

评论(3

蔚蓝源自深海 2024-08-18 16:42:29

您可以在桌面上创建一个包含以下内容的 .SAP 文件:

示例:

conn=/H/192.168.90.5/S/3210&clnt=300&lang=RO&tran=*ZME29N SO_EBELN-LOW=4500028729;
where 192.168.90.5 is the local sap server ip
3210 is the server port
300 is the client
RO - language
*ZME29N is the transaction followed by the select options.
  • (星号)表示系统将使用相应的选择选项执行事务。

You can create a .SAP file on the desktop with the following content:

example:

conn=/H/192.168.90.5/S/3210&clnt=300&lang=RO&tran=*ZME29N SO_EBELN-LOW=4500028729;
where 192.168.90.5 is the local sap server ip
3210 is the server port
300 is the client
RO - language
*ZME29N is the transaction followed by the select options.
  • (asterisk) means that the system will execute the transaction with the respective select options.
写下不归期 2024-08-18 16:42:29

如果您可以将程序连接到 SAP,您始终可以将 wiki 中的函数设置为 RFC,并从 SAP 获取链接。否则,您始终可以测试该函数以检查返回字符串。

该字符串可用于创建 SAP GUI 快捷方式。这些 Shortcups 具有 .sap 扩展名并包含之前的字符串。例如,这是测试 SAP GUI 快捷方式的内容:

[System]  
Name=IFR  
Description=IFR ECC 6.0  
Client=300  
[User]  
Name=gpatry  
Language=FR  
[Function]  
Title=Connexion SAP IFR  
Command=PA20  
[Configuration]  
WorkDir=D:\Documents and Settings\gpatry\SapWorkDir  
[Options]  
Reuse=0  

在您给出的示例中,此类字符串用于创建名称为“DisplayAddress.SAP”的附件。单击附件启动 GUI。

如果创建快捷方式还不够,您可以尝试执行打开快捷方式文件,就像打开 .doc 启动词一样。我必须承认我对这一点的无知。

希望这有帮助,
问候,
纪尧姆

If you can connect your programme to SAP, you could always set the function from the wiki as RFC, and get the link from SAP. Otherwise, you can always test the function to check the return string.

this string can be used to create a SAP GUI Shortcut. those shortcups possess the .sap extension and contains the previous string. For exemple this is the content of a test SAP GUI shortcut :

[System]  
Name=IFR  
Description=IFR ECC 6.0  
Client=300  
[User]  
Name=gpatry  
Language=FR  
[Function]  
Title=Connexion SAP IFR  
Command=PA20  
[Configuration]  
WorkDir=D:\Documents and Settings\gpatry\SapWorkDir  
[Options]  
Reuse=0  

In in the example you gave, such string was use to create an attachement in the name of "DisplayAddress.SAP" . A click on the attachement launch the GUI.

If creating a shortcut is not suffisant, you may try to exec opening the shortcut file, in the same way that open a .doc launch word. I must admit my ignorance on this particuliar point.

hope this helps,
regards,
Guillaume

情愿 2024-08-18 16:42:29

Guillaume (PATRY) 在生成 .SAP 快捷方式内容的一般方法中是正确的。如果您始终启动特定事务,另一种方法是使用硬编码(或资源检索)模板。

然后,您需要将其另存为文件并启动该文件。这可以按如下方式完成:

// Generate your .SAP shortcut content by calling an RFC, or manually filling a template.
String shortcutContent = ...;

File file = new File(...some path, probably inside temp dir...);

OutputStream os = new FileOutputStream(file);
os.write(shortcutContent.getBytes());
os.close();

String url = "file://" + file.getAbsolutePath();

// Ask OS to launch the file
Runtime runtime = Runtime.getRuntime();
String cmd = "rundll32 url.dll,FileProtocolHandler " + url;
runtime.exec(cmd);

// Remove file
file.deleteOnExit();

您当然需要围绕此代码添加适合周围体系结构的异常处理。

Guillaume (PATRY) is correct in the general approach to generating the .SAP shortcut content. An alternative approach if you are always launching a particular transaction is to use a hard-coded (or resource-retrieved) template.

You then need to save it as a file and launch the file. This can be done as follows:

// Generate your .SAP shortcut content by calling an RFC, or manually filling a template.
String shortcutContent = ...;

File file = new File(...some path, probably inside temp dir...);

OutputStream os = new FileOutputStream(file);
os.write(shortcutContent.getBytes());
os.close();

String url = "file://" + file.getAbsolutePath();

// Ask OS to launch the file
Runtime runtime = Runtime.getRuntime();
String cmd = "rundll32 url.dll,FileProtocolHandler " + url;
runtime.exec(cmd);

// Remove file
file.deleteOnExit();

You will of course need to add exception handling around this code appropriate to the surrounding architecture.

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