on 2018 Jun 27 5:27 AM
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
Hi Alef,
one possible solution might look like this:
. . .
session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1100/tabsTS_1100/tabpMUEB").select
'dim sapRow
'sapRow = 0
myVariable = "11.077.602"
do
set myTable = session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:3001/ssubSUB_LEVEL:SAPLCOIH:1107/tabsTS_1100/tabpMUEB/ssubSUB_AUFTRAG:SAPLCOMK:3020/tblSAPLCOMKTCTRL_3020")
rows = myTable.RowCount
cols = myTable.Columns.Count
vRows = myTable.VisibleRowCount
for i = 0 to vRows - 1
on error resume next
myCell = trim(myTable.GetCell(i,1).Text)
if err.number <> 0 then exit for
on error goto 0
if myCell = myVariable then
session.findById("wnd[0]").sendVkey 2
exit for
end if
next
if err.number <> 0 or myCell = myVariable then exit do
myTable.VerticalScrollbar.Position = myTable.VerticalScrollbar.Position + vRows
Loop
Regards,
ScriptMan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
70 | |
10 | |
10 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.