My script is loading data in SAP GUI Recipe screen (transaction code C202
) from Excel data.
In one of the Recipe screens, values are to be entered based on column "Phase" value from Excel. I need to update 2nd "Std Value" and 3rd "Std Value" for each particular "phase" from the Excel sheet.
Can you please help me with this ? I need to switch between rows to modify each phase
For i = 1 To LastRow
session.findById("wnd[0]/tbar[0]/okcd").Text = "/nC202"
session.findById("wnd[0]").sendVKey 0
Plant = shControlPanel.Range("A" & CurrentRow).Value
RecipeGroup = shControlPanel.Range("B" & CurrentRow).Value
Recipe = shControlPanel.Range("C" & CurrentRow).Value
ECR = shControlPanel.Range("D" & CurrentRow).Value
Phase = shControlPanel.Range("E" & CurrentRow).Value
Value2 = shControlPanel.Range("F" & CurrentRow).Value
Value3 = shControlPanel.Range("G" & CurrentRow).Value
session.findById("wnd[0]/usr/ctxtRC271-PLNNR").Text = RecipeGroup
session.findById("wnd[0]/usr/txtRC271-PLNAL").Text = Recipe
session.findById("wnd[0]/usr/ctxtRC27M-WERKS").Text = Plant
session.findById("wnd[0]/usr/ctxtRC271-AENNR").Text = ECR
session.findById("wnd[0]/usr/ctxtRC271-STTAG").Text = "04.09.2020"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 0
j = 1
PhaseToChange = session.findById("wnd[0]/usr/tabsTABSTRIP_RECIPE/tabpVOUE/ssubSUBSCREEN_RECIPE:SAPLCPDI:4401/tblSAPLCPDITCTRL_4401/txtPLPOD-VORNR[0," & j & "]").Text
Resorce = session.findById("wnd[0]/usr/tabsTABSTRIP_RECIPE/tabpVOUE/ssubSUBSCREEN_RECIPE:SAPLCPDI:4401/tblSAPLCPDITCTRL_4401/ctxtPLPOD-ARBPL[4," & j & "]").Text
Do While Resorce <> ""
PhaseToChange = session.findById("wnd[0]/usr/tabsTABSTRIP_RECIPE/tabpVOUE/ssubSUBSCREEN_RECIPE:SAPLCPDI:4401/tblSAPLCPDITCTRL_4401/txtPLPOD-VORNR[0," & j & "]").Text
Resorce = session.findById("wnd[0]/usr/tabsTABSTRIP_RECIPE/tabpVOUE/ssubSUBSCREEN_RECIPE:SAPLCPDI:4401/tblSAPLCPDITCTRL_4401/ctxtPLPOD-ARBPL[4," & j & "]").Text
If Phase = PhaseToChange Then
session.findById("wnd[0]/usr/tabsTABSTRIP_RECIPE/tabpVOUE/ssubSUBSCREEN_RECIPE:SAPLCPDI:4401/tblSAPLCPDITCTRL_4401/txtPLPOD-VGW02[18," & j & "]").Text = Value2
session.findById("wnd[0]/usr/tabsTABSTRIP_RECIPE/tabpVOUE/ssubSUBSCREEN_RECIPE:SAPLCPDI:4401/tblSAPLCPDITCTRL_4401/txtPLPOD-VGW03[21," & j & "]").Text = Value3
session.findById("wnd[0]").sendVKey 0
j = j + 1
Else
j = j + 1
End If
CurrentRow = CurrentRow + 1
Phase = shControlPanel.Range("E" & CurrentRow).Value
Value2 = shControlPanel.Range("F" & CurrentRow).Value
Value3 = shControlPanel.Range("G" & CurrentRow).Value
Loop
session.findById("wnd[0]/tbar[0]/btn[11]").press
On Error Resume Next
session.findById("wnd[1]/usr/btnSPOP-VAROPTION1").press
shControlPanel.Range("H" & CurrentRow).Value = "Recipe " & Recipe & " has been changed"
CurrentRow = CurrentRow + 1