[英]SAP GUI Scripting: read cell value in a table control
I want to read a cell value on a table - example on transaction C202 below.我想读取表格上的单元格值 - 下面以交易 C202 为例。
I can use SAP GUI Scripting Recorder to "check"
or "select"
(row = 5, column = 1)
, which is next to "0122"
and (row = 5, column = 1)
, which is next to "0125"
.我可以使用 SAP GUI 脚本记录器来"check"
或"select"
(row = 5, column = 1)
,它在"0122"
旁边和(row = 5, column = 1)
,它在"0125"
旁边.
It gives me a simple code:它给了我一个简单的代码:
''' selects 0122
session.findById("wnd[0]/usr/tabsTABSTRIP_RECIPE/tabpVOUE/ssubSUBSCREEN_RECIPE:SAPLCPDI:4401/tblSAPLCPDITCTRL_4401").getAbsoluteRow(4).selected = true
'''selects 0125
session.findById("wnd[0]/usr/tabsTABSTRIP_RECIPE/tabpVOUE/ssubSUBSCREEN_RECIPE:SAPLCPDI:4401/tblSAPLCPDITCTRL_4401").getAbsoluteRow(7).selected = true
However, it varies the rows available.但是,它会改变可用的行。
Sometimes there will be :有时会有:
0100, 0110, 0120, 0121, 0122, 0123, 0124, 0125, 0130, 0140
-sometimes there will be 0100, 0110, 0122, 0123, 0124, 0125, 0140
-sometimes there will be 0100, 0121, 0122, 0123, 0124, 0125, 0140
-sometimes there will be 0100, 0122, 0123, 0125, 0130, 0140
etc
I want to read column = 2 so I know if it's 0122 or 0125 and then check them.我想阅读 column = 2 所以我知道它是 0122 还是 0125 然后检查它们。
How could I put this value inside a variable and use msgbox to display it?我怎么能把这个值放在一个变量中并使用 msgbox 来显示它?
PSEUDO CODE
dim readVariable as string
for row = 1 to NumberOfRows
readVariable = Table.Read (row,2)
if readVariable = 0122
msgbox "row = " & row " & " is 0122"
end if
if readVariable = 0125
msgbox "row = " & row " & " is 0125"
end if
next
I tried following Link but I can't get it to work.我尝试关注链接,但我无法让它工作。
Thanks a lot!!!非常感谢!!!
使用 '&' 而不是 +,您将得到 01101,因为 VBS 将假定转换将被定向到字符串类型,并将您的字符串与“1”连接起来,而不是将您的字符串解析为变量的数字类型以简单地添加 1 .
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.