Skip to Content
0
Aug 06, 2020 at 02:13 PM

Untill Loop in SAP GUI

111 Views

Hi I am new to SAP GUI. I want to run loop until the next screen appears. Below I am sharing the GUI script I recorded and highlighted the area where I need the loop and also sharing the screen where I want to use that loop. Your help will be appreaciated.

Need this repetitively until next screen appears

"session.findById("wnd[1]").sendVKey 0"

If Not IsObject(application) Then
   Set SapGuiAuto  = GetObject("SAPGUI")
   Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
   Set connection = application.Children(0)
End If
If Not IsObject(session) Then
   Set session    = connection.Children(0)
End If
If IsObject(WScript) Then
   WScript.ConnectObject session,     "on"
   WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "va01"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtVBAK-AUART").text = "ZCRE"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[1]/usr/tabsMYTABSTRIP/tabpRFAK/ssubSUB1:SAPLV45C:0304/ctxtVBRK-VBELN").text = "6214557"
session.findById("wnd[1]/usr/tabsMYTABSTRIP/tabpRFAK/ssubSUB1:SAPLV45C:0304/ctxtVBRK-VBELN").caretPosition = 7
session.findById("wnd[1]/tbar[0]/btn[5]").press

session.findById("wnd[1]").sendVKey 0

session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\02/ssubSUBSCREEN_BODY:SAPMV45A:4415/cmbVBAK-FAKSK").key = " "
session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\02/ssubSUBSCREEN_BODY:SAPMV45A:4415/cmbVBAK-FAKSK").setFocus
session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\02/ssubSUBSCREEN_BODY:SAPMV45A:4415/subSUBSCREEN_TC:SAPMV45A:4902/subSUBSCREEN_BUTTONS:SAPMV45A:4050/btnBT_PKON").press
session.findById("wnd[0]/mbar/menu[1]/menu[12]").select
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").setCurrentCell -1,""
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").selectColumn "ANZEIGEPOS"
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").selectColumn "AUSGABETEXT"
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").selectColumn "FELD"
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").selectedRows = "0"
session.findById("wnd[0]/tbar[1]/btn[2]").press
session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_HEAD/tabpT\01/ssubSUBSCREEN_BODY:SAPMV45A:4301/cmbVBAK-AUGRU").key = "001"
session.findById("wnd[0]/tbar[0]/btn[3]").press
session.findById("wnd[0]").sendVKey 11
session.findById("wnd[0]/tbar[0]/btn[15]").press
session.findById("wnd[0]/tbar[0]/okcd").text = "VF01"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 11


Attachments

info-screen.jpg (314.3 kB)