SAP GUI script inputbox

Posted on 2014-08-07
Last Modified: 2014-08-08
session.findById("wnd[2]/usr/subBLOCK1:SAPLFKL0:0413/sub:SAPLFKL0:0413/ctxtRFKL0-VONSL[0,0]").text = inputbox("Enter filter for period.","kk",,,1)

I am using the SAP GUI scripting; when I use the inputbox in SAP the stupid thing opens up behind the session (must be some kind of German logic). Does anyone know how to make it so the inputbox opens up on top of the session so I can enter data? The code is below but that isn't the problem because I have tried different way to connect to the session the stupid thing always opens behind the session.

  Set SapGuiAuto = GetObject("SAPGUI")  'generic
      Set SapAppl = SapGuiAuto.GetScriptingEngine   'generic
      Set CollCon = SapAppl.Connections()       'connection

      '-Loop over connections-------------------------------------------
        For q = 0 To CollCon.Count() - 1

          Set oCon = SapAppl.Children(CLng(q))  'childeren
          If Not IsObject(oCon) Then
                 MsgBox "Issue found not GUIAuto"
          End If

          Set CollSes = oCon.Sessions()     'session
          If Not IsObject(CollSes) Then
                 MsgBox "Issue found not GUIAuto"
          End If
          '-Loop over sessions------------------------------------------
            For p = 0 To CollSes.Count() - 1
              Set oSes = oCon.Children(CLng(p))
              If Not IsObject(oSes) Then
                     MsgBox "Issue found not GUIAuto"
              End If
                Set oSesInf = oSes.Info()
                SID = oSesInf.SystemName()
                Trans = oSesInf.Transaction()
                    If SID = "REP" And Trans = "FPL9" Then
                        Set Connection = CollCon
                        Set session = oSes
'x = GUICtrlCreateInput("Some text 1", 10, 10, 200, 20)

session.findById("wnd[0]").resizeWorkingPane 142,55,false
session.findById("wnd[0]/usr/lbl[0,2]").caretPosition = 29
session.findById("wnd[1]/usr").verticalScrollbar.position = 9
session.findById("wnd[1]/usr/sub:SAPLFKL0:0400/chkRFKL0-XSUCH[4,0]").selected = true
session.findById("wnd[2]/usr/subBLOCK1:SAPLFKL0:0413/sub:SAPLFKL0:0413/ctxtRFKL0-VONSL[0,0]").text = inputbox("Enter filter for period.","kk",,,1)
session.findById("wnd[2]/usr/subBLOCK1:SAPLFKL0:0413/sub:SAPLFKL0:0413/ctxtRFKL0-VONSL[0,0]").caretPosition = 4
  If session.FindById("wnd[0]/sbar").messageType = "E" Or session.FindById("wnd[0]/sbar").text = "Search was unsuccessful" Then
      msgbox "Your search was unsuccessful.", vbcancel
end if
                    End If
Question by:faquue
    1 Comment

    Accepted Solution

    Disable Notify when a script attaches to SPA GUI

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
    Let’s list some of the technologies that enable smooth teleworking. 
    The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.
    Video by: Kyle
    After watching the Introduction to GIMP and additional tools to use in GIMP we are shown how to utilize multiple tools to create a 3D effect image.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now