-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSapTableInput.vbs
More file actions
42 lines (36 loc) · 1.69 KB
/
Copy pathSapTableInput.vbs
File metadata and controls
42 lines (36 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Option Explicit
'--------------------------------------------------------------------------------
' ScriptName : SapTableInput.vbs (was TableInputDataRow.vbs)
' Creator : Sungman Han
' Creation Date : 2019-05-21
' Description : Fills consecutive rows of a SAP GuiTableControl from a delimited
' string, scrolling down one row at a time.
'
' Usage : this file only declares routines. Paste it into the script that
' already owns a session, or combine both through a .wsf job:
'
' FillTableColumn vSession, _
' "wnd[1]/usr/tblSAPLSPO4TC_TABLE", "1000,1010,1020", ",", 0
' ConfirmPopup vSession
'
' Notes : GuiTableControl.GetCell(row, column) is ZERO based and addresses
' the *visible* window of the control, so the first visible row is
' index 0 after every scroll.
' The control must be resolved again after each scroll because SAP
' GUI rebuilds the child elements when the viewport moves.
'--------------------------------------------------------------------------------
Sub FillTableColumn(vSession, vTableId, vValues, vDelimiter, vColumnIndex)
Dim vTable, vCell, vRowIndex, vValue
vRowIndex = 0
For Each vValue In Split(vValues, vDelimiter)
vSession.findById(vTableId).verticalScrollbar.Position = vRowIndex
Set vTable = vSession.findById(vTableId)
Set vCell = vTable.GetCell(0, vColumnIndex)
vCell.Text = Trim(vValue)
vRowIndex = vRowIndex + 1
Next
End Sub
' Presses the green tick / save button of a modal popup (wnd[1]).
Sub ConfirmPopup(vSession)
vSession.findById("wnd[1]/tbar[0]/btn[8]").press
End Sub