[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1133
  • Last Modified:

SAP GUI script inputbox

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]").setFocus
session.findById("wnd[0]/usr/lbl[0,2]").caretPosition = 29
session.findById("wnd[0]/tbar[1]/btn[5]").press
session.findById("wnd[1]/tbar[0]/btn[12]").press
session.findById("wnd[0]/tbar[1]/btn[9]").press
session.findById("wnd[0]/tbar[1]/btn[5]").press
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[1]/usr/sub:SAPLFKL0:0400/chkRFKL0-XSUCH[4,0]").setFocus
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/tbar[0]/btn[0]").press
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
session.findById("wnd[2]/tbar[0]/btn[0]").press
  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
            Next
        Next
0
faquue
Asked:
faquue
1 Solution
 
faquueAuthor Commented:
Disable Notify when a script attaches to SPA GUI
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now