2021-06-27

create EXCEL VBA to save file from SAP [closed]

Wondering if I could get some assistance with SAP+VBA excel. I am a novice with SAP. I want to create in excel a VBA to download/save invoices from SAP HANA. I know how create and get a script in SAP HANA and copy paste in excel but it would not work. So my excel file would be simple:

  • Column A: list of the invoices to download

So I want the VBA to loop until the last invoice on the list

I have this script in SAP but it does not save. Plus I would like macro to copy the invoice in Column A and paste it in VF03 in a loop until all saved

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]").resizeWorkingPane 184, 32, False
session.findById("wnd[0]/tbar[0]/okcd").Text = "/nvf03"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtVBRK-VBELN").Text = "InvoiceNr in columnA"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX" 
session.findById("wnd[0]/titl/shellcont/shell").selectContextMenuItem "%GOS_VIEW_ATTA"

session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").selectedRows = "0" session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").doubleClickCurrentCell session.findById("wnd[1]").Close



from Recent Questions - Stack Overflow https://ift.tt/3A04OvB
https://ift.tt/eA8V8J

No comments:

Post a Comment