SAP GUI 脚本 VBA - 按钮按下被忽略

SAP GUI scripting VBA - Button press is ignored

我正在使用 SAP GUI 7.50 和 运行 来自 Excel 的脚本。我为交易 ZC9_SE16_MAT table MARA 录制了一个脚本。我想 select 多个 material 号码,但是用录制的脚本按下按钮会被忽略(不会打开新的 window)。该按钮已在图像中标记。我怎样才能打开那个 window?

' Connect to SAP
Set SapGuiAuto = GetObject("SAPGUISERVER")
Set SAPApp = SapGuiAuto.GetScriptingEngine
If Not IsObject(Connection) Then
       Set Connection = SAPApp.Children(0)
End If
If Not IsObject(session) Then
   Set session = Connection.Children(0)
End If
If Not IsObject(Connection) Then
   Set Connection = SAPApp.Children(0)
End If
If Not IsObject(session) Then
   Set session = Connection.Children(0)
End If
If IsObject(WScript) Then
   WScript.ConnectObject session, "on"
   WScript.ConnectObject Application, "on"
End If

' Start Transaction
session.StartTransaction "ZC9_SE16N_MAT"
' Confirm Mara
session.findById("wnd[0]").sendVKey 8

' Press the button
session.findById("wnd[0]/usr/tblSAPLZ_C9_SE16NSELFIELDS_TC/btnPUSH[4,1]").SetFocus
' Bellow line does not work
session.findById("wnd[0]/usr/tblSAPLZ_C9_SE16NSELFIELDS_TC/btnPUSH[4,1]").press

最后一行无效。

我在 this post 中看到了类似的问题,但答案对我不起作用。

我找到了解决问题的方法,但并不完美。按 Shift + F11,打开技术视图。然后出现选项Ctrl + F9,打开window Multiple Entry。这个新 window 看起来与第一个 window 非常相似,但现在记录了按下按钮的效果。

这解决了我的问题,但我仍然想知道如何按下第一个按钮,所以如果有人知道请添加答案。