Quantcast
Channel: SCN : Popular Discussions - SAP BusinessObjects Desktop Intelligence
Viewing all articles
Browse latest Browse all 681

Button "download to excel" using VBA ('save as' window)

$
0
0

Hello everyone!

 

I've seen many topics on forum but my problem isn't yet solved.

 

I start sap-script from Excel VBA. When SAPscript is ready to download report and press yellow button, process stops and requires an user action (window "save as"). A problem arises due to the fact, that "save as" window is out of SAPscript control.

As macros works in cycle, I have to input file name and type every time.

Capture1.PNG

 

Capture2.PNG

How can I escape this action without manual operation?

 

Sub Y_KLD_31001046()

 

Dim SapGuiApp As Object

Dim oConnection As Object

Dim SAPCon As Object, SAPSesi As Object

Dim SAPGUIAuto As Object, SAPApp As Object

 

'start sap

    If SapGuiApp Is Nothing Then

    Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")

    End If

 

    If oConnection Is Nothing Then

    Set oConnection = SapGuiApp.OpenConnection("F6P EU SC Prod - SSO", True)      'select SAP box

    End If

 

    If SAPSesi Is Nothing Then

    Set SAPSesi = oConnection.Children(0)

    End If

 

'start transaction

    SAPSesi.StartTransaction "Y_KLD_31001046"

 

'fill data

With SAPSesi

.findById("wnd[0]/tbar[0]/btn[0]").press

.findById("wnd[0]/usr/ctxtS_WERKS-LOW").Text = "8127"

.findById("wnd[1]/tbar[0]/btn[8]").press

.findById("wnd[0]/usr/ctxtS_DATE-LOW").Text = "01.06.2015"

.findById("wnd[0]/usr/radP_PERSU").SetFocus

.findById("wnd[0]/tbar[1]/btn[8]").press                                              'button Execute

 

.findById("wnd[0]/tbar[1]/btn[6]").press                                              'button "Download to Excel" (yellow selection)

.findById("wnd[0]/tbar[0]/btn[3]").press                                              'button "back"

End With

End Sub


Viewing all articles
Browse latest Browse all 681

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>