带有 SAPGUI 脚本的宏:SAPLMEGUI:0013,每个连接到 SAP 的最后一个数字发生变化

Macro with SAPGUI Scripting : SAPLMEGUI:0013, the last number changes in each connexion to SAP

我有一个宏一开始工作正常,直到它在断开连接并重新连接到 SAP 第二次连接后停止工作。

我注意到问题是,在每次连接中,SAPGui 脚本的这一部分会更改:"SAPLMEGUI:0013",更具体地说,每次更改的只是最后一个数字。

我正在寻求帮助,因为我仍然很难找到正确的方法。 我考虑过做这样的事情来解决这个问题(但它不起作用):

sub verifyAddress()

'an Array to go through all the possible addresses
tabl = Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)

'Looking for the correct address
for i = Lbound(tabl) to UBound(tabl)
SAPLineToBeChecked = "wnd(0)/usr/subSUBO : SAPLMEGUI:001" & tabl(i) & "/subSUB2...."

'check the next address
on error resume next
session.findByID(SAPLineToBeChecked).cartePosition = 0
next
end sub

提前谢谢你:)

解决它的最简单方法是尝试多个屏幕(dynpro 数字)并捕获错误。例如尝试 0000 到 0099,忽略错误,当找到时,使用这个作为其余部分。 对于这种情况,我就是这样做的(在 python 中)。在 Visual Basic 中应该可以,但我不再使用它了。

或者,您可以使用下面 link 中 Stefan Schnell 的回答。

https://answers.sap.com/questions/684650/vb-scripting-what-is-the-rule-behind-the-numbering.html

Stefan 是出色的 SAP Script Tracker 工具的作者。