Skip to Content
0
Jun 20, 2018 at 11:44 AM

Excel SAP script is not working in the front end;

97 Views

I tried the below script. But the Script is not running whereas i could notice that the excel shows completed

Sub Inbound_Creation() If Not IsObject(Application1) Then Set SapGuiAuto = GetObject("SAPGUI") Set Application1 = SapGuiAuto.GetScriptingEngine End If If Not IsObject(Connection) Then Set Connection = Application1.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 Application1, "on" End If session.findById("wnd[0]").maximize i = 4 While Sheets("input").Range("A" & i).Value <> "" session.findById("wnd[0]").maximize session.findById("wnd[0]/tbar[0]/okcd").Text = "/nVL31N" session.findById("wnd[0]").sendVKey 0 session.findById("wnd[0]/usr/txtLV50C-BSTNR").text = Sheets("input").Range("B" & i).Value session.findById("wnd[0]/usr/txtLV50C-BSTNR").setFocus session.findById("wnd[0]/usr/txtLV50C-BSTNR").caretPosition = 10 session.findById("wnd[0]").sendVKey 0