我试图使用sapgui脚本来读取通过t代码RZ11设置的参数“set /user_ Scripting”的“当前值”。我可以连接到SAP实例,登录并使用我的脚本执行RZ11。但是,我无法读取当前设置为"sapgui/user_scripting“的值,并将其打印到控制台。
self.session.findById("wnd[0]/tbar[0]/okcd").text = "rz11"
self.session.findById("wnd[0]").sendVKey(0)
time.sleep(2)
self.session.findById("wnd[0]/usr/ctxtTPFYSTRUCT-NAME").text = "sapgui/user_scripting"
value = self.session.findById("wnd[0]/usr/ctxtTPFYSTRUCT-TYPE").text
print(value)我正在使用上面的代码。但是控制台中的输出是“皂基/user_scripting”。我需要输出是“真”。请帮帮忙
发布于 2022-10-09 13:19:48
在我的SAP版本中使用RZ11时,它显示了一个GuiHTMLViewer对象:

从HTML控件读取数据有点困难。它也可能很复杂,因为有2种类型的HTML控件依赖于SAP设置。
我建议找到一个解决办法,通过GuiHTMLViewer以外的GUI对象显示该值,如下所示:
单击Change Value按钮的

- The value can be obtained with this code: self.session.findById("wnd[1]/usr/txtNEW\_PARVALUE").textRSPARAM (使用SA38或SE38)在GuiGridView控件中显示值;使用filter按钮只显示一行:
self.session.findById("wnd/usr/cntlGRID1/shellcont/shell").getCellValue(0,
- The value can be obtained with this code (the first argument 0 being the first row, followed by the column name which depends on the ABAP version):7.56: "USER_VALUE")
self.session.findById("wnd/usr/cntlGRID1/shellcont/shell").getCellValue(0,7.52: PAR_USER_WERT)
有关更多信息,请参见https://community.sap.com/topics/gui/scripting的API文档。
https://stackoverflow.com/questions/74002501
复制相似问题