【问题标题】:Get SAP GUI session from SAP Connection in SAP GUI 7.70 C#在 SAP GUI 7.70 C# 中从 SAP Connection 获取 SAP GUI 会话
【发布时间】:2022-10-20 18:19:12
【问题描述】:

我使用下面的代码从 SAP GUI 7.60 版本中的任何可用连接获取 SAP GUI 会话,但最近升级到 7.70 版本,它没有获取会话。

//Take the control of SAPGUI Script.
_sapROTWrapper = new CSapROTWrapper();
_SapGuilRot = _sapROTWrapper.GetROTEntry("SAPGUI");
_engine = _SapGuilRot.GetType().InvokeMember("GetSCriptingEngine", System.Reflection.BindingFlags.InvokeMethod,
null, _SapGuilRot, null);
_SAPApp = _engine as GuiApplication;
//Get the SAP connection count to check how many open connections are.
var count = _SAPApp.Connections.Count;
if (count > 0)
{
 //More than one connections are there.
 var connections = _SAPApp.Connections;
 //Get all connections and iterate through all.
 foreach (GuiConnection connection in connections)
 {
    _repSession = connection.Children.ElementAt(0) as GuiSession;
 }
}

升级此行后未显示任何元素 _repSession = connection.Children.ElementAt(0) as GuiSession; 并抛出错误

The enumerator of the collection cannot find an element with the specified index.

尽管会话 connection.Children.Count 已经运行,但返回 0 个会话。

任何面临相同问题或有任何解决方案的人。感谢你的帮助。

【问题讨论】:

    标签: c# sap-gui


    【解决方案1】:

    从以下位置下载最新版本的“Scripting Tracker”: https://tracker.stschnell.de/

    以下是一些如何使用 Tracker 的指南: https://blogs.sap.com/2014/11/20/scripting-tracker-development-tool-for-sap-gui-scripting/

    或使用谷歌查找有关如何使用它的任何指南。

    【讨论】:

      猜你喜欢
      • 2019-04-15
      • 2016-01-16
      • 2018-12-06
      • 1970-01-01
      • 1970-01-01
      • 2020-05-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多