08-12-2018 5:43 AM
Hello everyone, I need help in vbs code below, I am trying to run but always have problems in bold lineand the message in SAP is "The control could not be found by id", the script was recor by SAP but when I satart the screipt is stopen in the part of:
*** session.findById("wnd[0]/titl/shellcont/shell").pressButton "%GOS_TOOLBOX"****
I count on your help to solve this problem. Thank you!
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.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
session.findById("wnd[0]/tbar[0]/okcd").text = "/NFB03"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/txtRF05L-BELNR").text = "1651002944"
session.findById("wnd[0]/usr/ctxtRF05L-BUKRS").text = "2000"
session.findById("wnd[0]/usr/txtRF05L-GJAHR").text = "2016"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/titl/shellcont/shell").pressButton "%GOS_TOOLBOX"
session.findById("wnd[0]/shellcont/shell").pressButton "VIEW_ATTA"
session.findById("wnd[1]").close