There is probably a way to do it, but I think it will be cumbersome to get to the final result.
You can easily create a macro and assign it to a button in the Excel with the following code:
Sub SAPFullProcess()
'******** VBA REFERENCES ********
'Reference to sapfewse.ocx (if not available - Browse... and search for the file C:\Program Files\SAP\FrontEnd\SAPgui\sapfewse.ocx)
'******** VBA REFERENCES ********
'*****************************
'ATTACH SAP Window
'*****************************
Dim SapGuiAuto As Object
Dim Application As SAPFEWSELib.GuiApplication
Dim Connection As SAPFEWSELib.GuiConnection
Dim Session As SAPFEWSELib.GuiSession
Set SapGuiAuto = GetObject("SAPGUI")
If Not IsObject(SapGuiAuto) Then
Exit Sub
End If
Set Application = SapGuiAuto.GetScriptingEngine()
If Not IsObject(Application) Then
Exit Sub
End If
Set Connection = Application.Children(0)
If Not IsObject(Connection) Then
Exit Sub
End If
Set Session = Connection.Children(0)
If Not IsObject(Session) Then
Exit Sub
End If
'Exit in case SAP is not open
If err.Number <> 0 Then
MsgBox "SAP is not open, please open a session and try again."
Set Session = Nothing
Set Connection = Nothing
Set Application = Nothing
Set SapGuiAuto = Nothing
Exit Sub
End If
On Error GoTo ErrHandler
Session.findById("wnd[0]").maximize
Session.findById("wnd[0]/tbar[0]/okcd").text = "MIRO"
Session.findById("wnd[0]").sendVKey 0
' ** Here will continue all the steps from the recorder **
'Reset Variables
Set Session = Nothing
Set Connection = Nothing
Set Application = Nothing
Set SapGuiAuto = Nothing
Exit Sub
ErrHandler:
MsgBox err.Description
End Sub
This piece of code will connect to the currently open SAP Session and will perform the operations in there. You just need to add the steps from the recorder in this line ' ** Here will continue all the steps from the recorder **
Only thing needed for this to run correctly is to go to VBA Editor -> Tools -> References... and look for SAP GUI Scripting API. If it is not there, you can click on Browse... and search for this ocx file: C:\Program Files\SAP\FrontEnd\SAPgui\sapfewse.ocx