简体   繁体   中英

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.

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" .

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.

How could I put this value inside a variable and use msgbox to display it?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM