cancel
Showing results for 
Search instead for 
Did you mean: 

the control could not be found by id

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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")

Former Member
0 Kudos

Hi Bart,

how would the above code?


Thank You!


Alysson

Former Member
0 Kudos

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

Former Member
0 Kudos

Is running , thank you Bart!

Former Member
0 Kudos

Hi Alysson,

You're welcome.

But you marked your own last comment as "Correct Answer" instead of my actual answer

Answers (0)