on 12-06-2022 9:05 AM
Dear SAP experts,
So far I am using a VBA macro to transfer VA05 results into an Excel file.
I select the result table and copy it into the clipboard. From there I paste it into an Excel file.
Code in short (no error handling and so on):
Set SapGuiAuto = GetObject("SAPGUI")
Set SAPApplication = SapGuiAuto.GetScriptingEngine
Set Connection = SAPApplication.Children(0)
Set Session = Connection.Children(0)
'VA05
Session.findById("wnd[0]/tbar[0]/okcd").Text = "/nva05"
Session.findById("wnd[0]").sendVKey 0
Session.findById("wnd[0]/usr/ctxtVBCOM-KUNDE").Text = "1000000000"
Session.findById("wnd[0]/usr/ctxtVBCOM-AUDAT").Text = "01.12.2021"
Session.findById("wnd[0]").sendVKey 0
'copy into clipboard
Session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").SelectAll
Session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").contextMenu
Session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").selectContextMenuItemByPosition "0" 'wählt den ersten Eintrag im Context-Menu aus
'paste into Excel file:
ThisWorkbook.Sheets("SAPtmp").Range("A2").PasteSpecial SkipBlanks:=True
This works well, but there are two main limitations:
For that reason I would prefer to directly save the VA05 result sheet in Excel via the macro. Is there a simple way of doing so? Any other idea to overcome above mentioned limitations?
Thank you,
Jolem
User | Count |
---|---|
83 | |
11 | |
10 | |
8 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.