on 2018 Apr 17 7:51 AM
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
Request clarification before answering.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I have similar issue same as you.
how could I apply IF function if I have two different SAP scripting after I have re-record again and find out the problem here. Please advise the macro expert here 🙂
first code
session.findById("wnd[0]/usr/sub/1[0,0]/sub/1/8[0,9]/sub/1/8/9[0,12]/lbl[23,12]").SetFocus
session.findById("wnd[0]/usr/sub/1[0,0]/sub/1/8[0,9]/sub/1/8/9[0,12]/lbl[23,12]").caretPosition = 2
second code
session.findById("wnd[0]/usr/sub/1[0,0]/sub/1/9[0,10]/sub/1/9/10[0,13]/lbl[32,13]").SetFocus
session.findById("wnd[0]/usr/sub/1[0,0]/sub/1/9[0,10]/sub/1/9/10[0,13]/lbl[32,13]").caretPosition = 2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Xixi,
Thank you for visiting SAP Community to get answers to
your questions. Since you're asking a question here for the first time please
note that:
You are adding a comment to an old post that is not likely to get an answer.
I suggest starting a new question and following these guidelines:
I
recommend that you familiarize yourself with: https://community.sap.com/resources/questions-and-answers, as it
provides tips for preparing questions that draw responses from our members.
For example, you can:
- outline what steps you took to find answers (and why they weren't helpful)
- share screenshots of what you've seen/done
- make sure you've applied the appropriate tags
- use a more descriptive subject line
The more details you provide, the more likely it is that members will be able
to respond. Feel free to also take our Q&A tutorial at: https://developers.sap.com/tutorials/community-qa.html
Should you wish, you can revise your question by selecting Actions, then Edit.
By adding a picture to your profile you encourage readers to respond:
https://developers.sap.com/tutorials/community-profile.html
Regards,
Dedi
Thank you! It worked!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
30 | |
9 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.