![]() So in the future you can just start calling your SAP transaction with defined filters out of Excel. If you added all this VBA code into one Sub Routine in Excel you’re done. Below you will find an easy solution for this, which is already sufficient enough for our task: ‘Disable the Application Alert before saving the file Application.DisplayAlerts = False Windows(“FileName”).Activate ActiveWorkbook.SaveAs FileName:=”C:\FileName.xlsx”, FileFormat _ :=xlOpenXMLWorkbook, CreateBackup:=False ‘Enabling the Application Alerts after saving the file Application.DisplayAlerts = True 'to “clean up” SAP we return back to SAP’s Easy Access: SAPsession.findById(“wnd/tbar/btn”).press SAPsession.findById(“wnd/tbar/btn”).press SAPsession.findById(“wnd/tbar/btn”).press End sub() Finally, we also want to save this file to a defined path. Until now we have run the SAP transactions with defined filters and exported the results as an Excel file. The only modification you have to do is to replace session with SAPsession, so finally it looks something like this in your Excel module: SAPsession.findById(“wnd”).maximize SAPsession.findById(“wnd/tbar/okcd”).Text = “iw29” SAPsession.findById(“wnd”).sendVKey 0 SAPsession.findById(“wnd/usr/chkDY_MAB”).Selected = False SAPsession.findById(“wnd/usr/ctxtQMART-LOW”).Text = “z2” SAPsession.findById(“wnd/usr/ctxtDATUV”).Text = “10012021” SAPsession.findById(“wnd/usr/ctxtDATUB”).Text = “26012021” SAPsession.findById(“wnd/usr/ctxtDATUB”).SetFocus SAPsession.findById(“wnd/usr/ctxtDATUB”).caretPosition = 8 SAPsession.findById(“wnd”).sendVKey 0 SAPsession.findById(“wnd/tbar/btn”).press SAPsession.findById(“wnd/tbar/btn”).press SAPsession.findById(“wnd/tbar/btn”).press SAPsession.findById(“wnd/tbar/btn”).press SAPsession.findById(“wnd/tbar/btn”).press Back in your Excel VBA module, you now paste in the recorded session tasks (the transaction’s filters).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |