Skip to Content
0

VBA & SAP GUI Script Error "619": Control Could Not Be Found by ID

4 days ago

67

avatar image

Hello there,

We've been running this VBA Macro for a while then it suddenly stopped working. I tried to specify the 'session.StartTransaction' window again, but it still doesn't work as it runs into 'Error 619: Control could not be found by ID.

Here's the script:

The debug stops at this line when the error message occurs:

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\01/ssubSUBSCREEN_BODY:SAPMV45A:4400/subSUBSCREEN_TC:SAPMV45A:4900/subSUBSCREEN_BUTTONS:SAPMV45A:4050/btnBT_MKAL").press 
Set SapGuiAuto = GetObject("SAPGUI") 
Set App = SapGuiAuto.GetScriptingEngine 
Set Connection = App.Children(0) 
Set session = Connection.Children(0) 

lr = Cells(Rows.Count, "A").End(xlUp).Row 
For i = 2 To lr 

session.findById("wnd[0]").maximize 
session.startTransaction "/nVA02" 
session.findById("wnd[0]/usr/ctxtVBAK-VBELN").Text = Cells(i, 1) 
session.findById("wnd[0]").sendVKey 0 
session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\01/ssubSUBSCREEN_BODY:SAPMV45A:4400/subSUBSCREEN_TC:SAPMV45A:4900/subSUBSCREEN_BUTTONS:SAPMV45A:4050/btnBT_MKAL").press 
session.findById("wnd[0]/mbar/menu[1]/menu[1]/menu[0]").Select session.findById("wnd[1]/usr/cmbRV45A-S_ABGRU").Key = "11" 
session.findById("wnd[1]/tbar[0]/btn[7]").press 

If session.ActiveWindow.Name = "wnd[2]" Then 
session.findById("wnd[2]/tbar[0]/btn[0]").press 
End If 

session.findById("wnd[0]/tbar[0]/btn[11]").press 
Cells(i, 2) = session.findById("wnd[0]/sbar").Text 
Next i 

End Sub

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Script Man 3 days ago
0

Hi Julien,

I do not have access to transaction VA02. However, I suspect that pressing the switch must be re-recorded using the SAP GUI script recorder. Presumably, something has changed at this point.

Regards,

ScriptMan

Share
10 |10000 characters needed characters left characters exceeded
Julien Perricault 2 days ago
0

Script Man Thank you for your reply!

I did suspect that something had changed since the macro was first recorded. Is it possible that the code for the SAP path has changed with updates? Also, if I re-record the transaction on SAP, I should only replace the code starting with session., correct?

Thanks again!

Share
10 |10000 characters needed characters left characters exceeded
Script Man 2 days ago
0

Hi Julien,

I would just record the following command and replace it:

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\01/ssubSUBSCREEN_BODY:SAPMV45A:4400/subSUBSCREEN_TC:SAPMV45A:4900/subSUBSCREEN_BUTTONS:SAPMV45A:4050/btnBT_MKAL").press 

Regards,

ScriptMan

Share
10 |10000 characters needed characters left characters exceeded
Julien Perricault 22 hours ago
0

Thank you! It worked!

Share
10 |10000 characters needed characters left characters exceeded