on 07-14-2016 11:26 PM
Hi
I was trying to create a SAP Gui script to run a process for many materials.
see below I created it for one material, but to run in simultaneously for 2 material I just repeated the code..
but how can I run just once the code N amount of time and It gets values from some table.
note that I used to to it using Excel SAP gui scritp, but it was easy because it just created an additional table to populate values tu run for many items
thanks
this is just and example for one time run
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 = "/Nmm02"
session.findById("wnd[0]/tbar[0]/btn[0]").press
session.findById("wnd[0]/usr/ctxtRMMG1-MATNR").text = "96148673"
session.findById("wnd[0]/usr/ctxtRMMG1-MATNR").caretPosition = 8
session.findById("wnd[0]/tbar[0]/btn[0]").press
session.findById("wnd[1]/usr/tblSAPLMGMMTC_VIEW").getAbsoluteRow(0).selected = true
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/usr/ctxtRMMG1-WERKS").text = "0302"
session.findById("wnd[1]/usr/ctxtRMMG1-LGORT").text = ""
session.findById("wnd[1]/usr/ctxtRMMG1-LGORT").setFocus
session.findById("wnd[1]/usr/ctxtRMMG1-LGORT").caretPosition = 0
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[0]/tbar[0]/btn[11]").press
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 = "/Nmm02"
session.findById("wnd[0]/tbar[0]/btn[0]").press
session.findById("wnd[0]/usr/ctxtRMMG1-MATNR").text = "96279413"
session.findById("wnd[0]/usr/ctxtRMMG1-MATNR").caretPosition = 8
session.findById("wnd[0]/tbar[0]/btn[0]").press
session.findById("wnd[1]/usr/tblSAPLMGMMTC_VIEW").getAbsoluteRow(0).selected = true
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[1]/usr/ctxtRMMG1-WERKS").text = "0302"
session.findById("wnd[1]/usr/ctxtRMMG1-LGORT").text = ""
session.findById("wnd[1]/usr/ctxtRMMG1-LGORT").setFocus
session.findById("wnd[1]/usr/ctxtRMMG1-LGORT").caretPosition = 0
session.findById("wnd[1]/tbar[0]/btn[0]").press
session.findById("wnd[0]/tbar[0]/btn[11]").press
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.