Skip to Content
0
Jul 02, 2019 at 04:47 AM

GUI scripting sap

1501 Views

I'm Trying to make a scripting for mass upload so what I did means I gone to sap record play back and I recoreded the steps and i tried play option it is running as the same material , same plant and same plant specific status here i need to connect my Excel but i have no idea i searched in internet also but till now i unable to find the solution...

Recorded scripts is given below,

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 = "/nzpb2"

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

session.findById("wnd[0]/usr/ctxtRMMG1-MATNR").text = "910402635318"

session.findById("wnd[0]/usr/ctxtRMMG1-MATNR").caretPosition = 12

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

session.findById("wnd[1]/usr/tblSAPLMGMMTC_VIEW").getAbsoluteRow(5).selected = true

session.findById("wnd[1]/usr/tblSAPLMGMMTC_VIEW/txtMSICHTAUSW-DYTXT[0,5]").setFocus

session.findById("wnd[1]/usr/tblSAPLMGMMTC_VIEW/txtMSICHTAUSW-DYTXT[0,5]").caretPosition = 0

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

session.findById("wnd[1]/usr/ctxtRMMG1-WERKS").text = "SG03"

session.findById("wnd[1]/usr/ctxtRMMG1-WERKS").caretPosition = 4

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

session.findById("wnd[0]/usr/tabsTABSPR1/tabpSP11/ssubTABFRA1:SAPLMGMM:2000/subSUB2:SAPLMGD1:2301/ctxtMARC-MMSTA").text = "ZG"

session.findById("wnd[0]/usr/tabsTABSPR1/tabpSP11/ssubTABFRA1:SAPLMGMM:2000/subSUB2:SAPLMGD1:2301/ctxtMARC-MMSTD").text = "18.06.2019"

session.findById("wnd[0]/usr/tabsTABSPR1/tabpSP11/ssubTABFRA1:SAPLMGMM:2000/subSUB2:SAPLMGD1:2301/ctxtMARC-MMSTA").setFocus

session.findById("wnd[0]/usr/tabsTABSPR1/tabpSP11/ssubTABFRA1:SAPLMGMM:2000/subSUB2:SAPLMGD1:2301/ctxtMARC-MMSTA").caretPosition = 2

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

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