Skip to Content
0
Jun 27, 2018 at 04:27 AM

Search Value in Grid SAP.

181 Views Last edit Jan 17, 2019 at 07:38 AM 2 rev

Good afternoon,

I'm having trouble finding a value in the SAP table, for example, I have the value "11,077,602", I need to fetch it in the SAP table and double click when it finds, can anyone help me with VBS? I could not go ahead as per the code below.

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]").resizeWorkingPane 80,36,false
session.findById("wnd[0]/tbar[0]/okcd").text = "iw33"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtCAUFVD-AUFNR").text = "2016133421"
session.findById("wnd[0]/usr/ctxtCAUFVD-AUFNR").caretPosition = 10
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100/tabsTS_1100/tabpMUEB").select
session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1107/tabsTS_1100/tabpMUEB/ssubSUB_AUFTRAG:SAPLCOMK:3020/tblSAPLCOMKTCTRL_3020/ctxtRESBD-MATNR[1,0]")

dim sapRow

sapRow = 0

Set GRID1 = session.FindById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1107/tabsTS_1100/tabpMUEB/ssubSUB_AUFTRAG:SAPLCOMK:3020/tblSAPLCOMKTCTRL_3020")

sapRow = GRID1.rowCount - 1

For sapRow = 0 to GRID1.rowCount - 1

'run row

next