on 05-25-2016 1:35 PM
Hi, how are you!
I would run the script to process many script entries below, but this giving error: The control could not be found for id.The code does not go into loop. Run only one entry.
How can I run varies entries?
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]").maximize
session.findById("wnd[0]/usr/ctxtP_MUNIC").text = ""
session.findById("wnd[0]/usr/ctxtP_STCD").text = "201387"
session.findById("wnd[0]/usr/ctxtP_STCD").caretPosition = 6
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[1]/usr/btnBUTTON_1").press
Thank you so much!
Alysson
Hi Alysson,
The T-Code is not specified in your code, so you're probably running it from the wrong T-Code.
Add session.startsession "T-Code" after "End if"
(Change "T-Code" with the relevant T-'Code, eg. "FBL5N")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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]").maximize
session.StartTransaction "/nFBL5N" 'or whatever you're using
session.findById("wnd[0]/usr/ctxtP_MUNIC").text = ""
session.findById("wnd[0]/usr/ctxtP_STCD").text = "201387"
session.findById("wnd[0]/usr/ctxtP_STCD").caretPosition = 6
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[1]/usr/btnBUTTON_1").press
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.