cancel
Showing results for 
Search instead for 
Did you mean: 

How can I integrate variables in a SAP GUI ID?

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

script_man
Active Contributor
0 Kudos

Hi Lars,

this topic was discussed several times in the forum.

for example: https://archive.sap.com/discussions/thread/3492959

Regards,

ScriptMan