on 03-26-2019 8:02 AM
I have recorded below SAP Script to download a report from SAP in Excel format. But the script recording does not work since it pop up window to let me choose the file path & file name.
I have try methods I can find in community, but it doesn't work, either.
So How can I save this kinds of file? I have to use the Excel VBA.
Here is to share you the script:
Public Sub DownloadPO()
Dim SapGuiAuto As Object
Dim App As Object
Dim connection As Object
Dim session As Object
If App Is Nothing Then
Set SapGuiAuto = GetObject("SAPGUI")
Set App = SapGuiAuto.GetScriptingEngine
End If
If connection Is Nothing Then
Set connection = App.Children(0)
End If
If session Is Nothing Then
Set session = connection.Children(0)
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").Text = "/nzc564"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[1]/btn[17]").press
session.findById("wnd[1]/usr/txtV-LOW").Text = "mrpview"
session.findById("wnd[1]/usr/txtENAME-LOW").Text = ""
session.findById("wnd[1]/usr/txtV-LOW").CaretPosition = 5
session.findById("wnd[1]").sendVKey 0
session.findById("wnd[1]/tbar[0]/btn[8]").press
session.findById("wnd[0]/tbar[1]/btn[8]").press
session.findById("wnd[0]/tbar[1]/btn[2]").press 'pop up window
End Sub
Hi maplecui
I got it. I can did. Now I save the Excel file downloaded from SAP.
I going to try to write the step by step to teach you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ivan,
I have found this solution and it works.
Hi.
I have the same trouble.
Any clue to how to solve it?
Thanks a Lot!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
12 | |
10 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.