Skip to Content
0
Former Member
Jun 15, 2017 at 07:35 AM

How can I integrate variables in a SAP GUI ID?

139 Views

Hello Community!

I want to integrate a loop in a scripting. Please find an example below.

How can I insert the variables (in example "i") in the string of the scripting??

thank you in advance!

' actual code:
Cells(1, 2).Value = oSession.FindById("wnd[0]/usr/tblSAPLCPDITCTRL_1400/ctxtPLPOD-ARBPL[2,0]").Text
Cells(1, 3).Value = oSession.FindById("wnd[0]/usr/tblSAPLCPDITCTRL_1400/ctxtPLPOD-STEUS[5,0]").Text
Cells(1, 4).Value = oSession.FindById("wnd[0]/usr/tblSAPLCPDITCTRL_1400/txtPLPOD-LTXA1[6,0]").Text
Cells(1, 5).Value = oSession.FindById("wnd[0]/usr/tblSAPLCPDITCTRL_1400/txtPLPOD-VGW02[14,0]").Text

Cells(2, 2).Value = oSession.FindById("wnd[0]/usr/tblSAPLCPDITCTRL_1400/ctxtPLPOD-ARBPL[2,1]").Text
Cells(2, 3).Value = oSession.FindById("wnd[0]/usr/tblSAPLCPDITCTRL_1400/ctxtPLPOD-STEUS[5,1]").Text
Cells(2, 4).Value = oSession.FindById("wnd[0]/usr/tblSAPLCPDITCTRL_1400/txtPLPOD-LTXA1[6,1]").Text
Cells(2, 5).Value = oSession.FindById("wnd[0]/usr/tblSAPLCPDITCTRL_1400/txtPLPOD-VGW02[14,1]").Text
'...

'target:
Dim i As Integer
For i = 1 To 10
Cells(i, 2).Value = oSession.FindById("wnd[0]/usr/tblSAPLCPDITCTRL_1400/ctxtPLPOD-ARBPL[2,i]").Text
Cells(i, 3).Value = oSession.FindById("wnd[0]/usr/tblSAPLCPDITCTRL_1400/ctxtPLPOD-STEUS[5,i]").Text
Cells(i, 4).Value = oSession.FindById("wnd[0]/usr/tblSAPLCPDITCTRL_1400/txtPLPOD-LTXA1[6,i]").Text
Cells(i, 5).Value = oSession.FindById("wnd[0]/usr/tblSAPLCPDITCTRL_1400/txtPLPOD-VGW02[14,i]").Text
Next i