avatar image
Former Member

Using the SAP GUI Scripting tool is it possible to export a file as an ".XLSX" ?

Hi Experts,

I'm attempting to write some VBA which exports my transaction to a file which I can then copy over into a separate worksheet. When I do this process manually I click List---> Export---> Spreadsheet which comes out as a ".XLSX" file however that process isnt recognised by the Scripting tool so currently I am using "%pc" in the transaction bar but this only allows the file to be saved as a ".txt" file which messes with the formatting. Is there a way to export a file to a spreadsheet as ".XLSX" that the Scripting tool picks up?

Any help would be greatly appreciated!

Thanks

Ryan

Add comment
10|10000 characters needed characters exceeded

  • Hello Ryan,

    I assume you mean this button in the toolbar:

    You can use AutoIt to solve your problem.

    session.findById("wnd[0]/tbar[1]/btn[43]").press
    session.findById("wnd[1]/usr/radRB_OTHERS").setFocus
    session.findById("wnd[1]/usr/radRB_OTHERS").select
    session.findById("wnd[1]/usr/cmbG_LISTBOX").key = "10"
    session.findById("wnd[1]/tbar[0]/btn[0]").press
    
    Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
    oAutoIt.WinWait "Speichern unter" 'Speichern unter = Save as in German
    oAutoIt.WinActivate "Speichern unter"
    FileName = "Test.xlsx"
    oAutoIt.Send "{ALTDOWN}n{ALTUP}" 'Alt+n to activate the name field
    oAutoIt.Send FileName
    oAutoIt.Send "{ALTDOWN}s{ALTUP}" 'Alt+s to save the file
    <br>

    As you can see my code waits until the "Save as" dialog is available. If it is, it sets it in foreground and activates it. Now the code sends Alt+n to set the filename and Alt+s to save the file. Is AutoIt an option for you? AutoIt is very good and easy bridge between SAP GUI Scripting on the one hand and Windows OS on the other hand.

    Let us know your results.

    Cheers
    Stefan

    export001.jpg (29.5 kB)
  • Former Member Stefan Schnell

    Hi Stefan,

    Thanks for the response. Unfortunately downloading software is prohibited on my computer so AutoIt isn't an option for me.

    Thanks

    Ryan

  • Get RSS Feed

1 Answer

  • Dec 19, 2016 at 11:24 AM

    Hi Ryan,

    you can see the following link:

    https://www.dv-treff-community.de/sap-hilfe/SAP-Tabelle-nach-Excel-importieren-t17643

    Unfortunately only in German...

    Regards,

    ScriptMan

    Add comment
    10|10000 characters needed characters exceeded

Skip to Content