文档库 最新最全的文档下载
当前位置:文档库 › SAP Gui script

SAP Gui script

Private Sub CommandButton1_Click()
Set Connection = GetObject("SAPGUI").GetScriptingEngine.Children(0)
If Not IsObject(Session) Then
Set Session = Connection.Children(0)
End If
'
Set Session = Connection.Children(0)
'Excute the action in SAP
For i = 2 To Sheet1.Range("A65536").End(xlUp).Row

Session.findById("wnd[0]").maximize
Session.findById("wnd[0]/tbar[0]/okcd").Text = "/nmm02"
Session.findById("wnd[0]").sendVKey 0
Session.findById("wnd[0]/usr/ctxtRMMG1-MATNR").Text = "d-103102"
Session.findById("wnd[0]/usr/ctxtRMMG1-MATNR").caretPosition = 8
Session.findById("wnd[0]").sendVKey 0
Session.findById("wnd[1]/usr/tblSAPLMGMMTC_VIEW").getAbsoluteRow(0).Selected = True
Session.findById("wnd[1]/usr/tblSAPLMGMMTC_VIEW").getAbsoluteRow(1).Selected = True
Session.findById("wnd[1]/usr/tblSAPLMGMMTC_VIEW/txtMSICHTAUSW-DYTXT[0,1]").SetFocus
Session.findById("wnd[1]/usr/tblSAPLMGMMTC_VIEW/txtMSICHTAUSW-DYTXT[0,1]").caretPosition = 0
Session.findById("wnd[1]/tbar[0]/btn[0]").press
Session.findById("wnd[1]/usr/ctxtRMMG1-WERKS").Text = "1000"
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]/usr/tabsTABSPR1/tabpSP01/ssubTABFRA1:SAPLMGMM:2004/subSUB1:SAPLMGD1:1002/txtMAKT-MAKTX").Text = "Material test script"
Session.findById("wnd[0]/usr/tabsTABSPR1/tabpSP01/ssubTABFRA1:SAPLMGMM:2004/subSUB1:SAPLMGD1:1002/txtMAKT-MAKTX").caretPosition = 20
Session.findById("wnd[0]").sendVKey 0
Session.findById("wnd[0]/tbar[0]/btn[11]").press
Next
End Sub

相关文档
相关文档 最新文档