[ABAP] Screenshot speichern

DATA: lv_mime_type TYPE string.
DATA: lv_image_bytes TYPE xstring.

TRY.
* Screenshot aufnehmen
    cl_gui_frontend_services=>get_screenshot( IMPORTING
                                                mime_type_str = lv_mime_type
                                                image         = lv_image_bytes ).

* MIME-Typ (PNG) ausgeben
    WRITE: / lv_mime_type.

    DATA: lv_action TYPE i.
    DATA: lv_filename TYPE string.
    DATA: lv_fullpath TYPE string.
    DATA: lv_path TYPE string.

* Savedialog anzeigen
    cl_gui_frontend_services=>file_save_dialog( EXPORTING
                                                  default_file_name = 'image.png'
                                                  default_extension = 'png'
                                                  file_filter       = '(*.png)|*.png|'
                                                CHANGING
                                                  filename          = lv_filename
                                                  path              = lv_path
                                                  fullpath          = lv_fullpath
                                                  user_action       = lv_action ).

    IF lv_action EQ cl_gui_frontend_services=>action_ok.

* XSTRING -> SOLIX (RAW)
      DATA(it_raw_data) = cl_bcs_convert=>xstring_to_solix( EXPORTING iv_xstring = lv_image_bytes ).

* Daten lokal speichern
      cl_gui_frontend_services=>gui_download( EXPORTING
                                                filename = lv_fullpath
                                                filetype = 'BIN'
                                              CHANGING
                                                data_tab = it_raw_data ).

    ENDIF.
  CATCH cx_root INTO DATA(e_txt).
ENDTRY.

[ABAP] Listenausgabe in Spool umleiten und als PDF ausgeben

* Liste -> Spool (ID)
NEW-PAGE PRINT ON NO DIALOG.
WRITE: / 'Hello World'.
NEW-PAGE PRINT OFF.

COMMIT WORK.

DATA: it_pdf_tline TYPE tline_tab.
DATA: lv_bin_length TYPE i.

* Spool (ID) -> PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
  EXPORTING
    src_spoolid              = CONV tsp01-rqident( sy-spono )
    no_dialog                = abap_true
    get_size_from_format     = abap_true
  IMPORTING
    pdf_bytecount            = lv_bin_length
  TABLES
    pdf                      = it_pdf_tline
  EXCEPTIONS
    err_no_abap_spooljob     = 1
    err_no_spooljob          = 2
    err_no_permission        = 3
    err_conv_not_possible    = 4
    err_bad_destdevice       = 5
    user_cancelled           = 6
    err_spoolerror           = 7
    err_temseerror           = 8
    err_btcjob_open_failed   = 9
    err_btcjob_submit_failed = 10
    err_btcjob_close_failed  = 11
    OTHERS                   = 12.

IF sy-subrc = 0.

  DATA: lv_action TYPE i.
  DATA: lv_filename TYPE string.
  DATA: lv_fullpath TYPE string.
  DATA: lv_path TYPE string.

  TRY.
* SaveDialog aufrufen
      cl_gui_frontend_services=>file_save_dialog( EXPORTING
                                                    default_extension   = 'pdf'
                                                    default_file_name   = 'ListOutput'
                                                    file_filter         = |PDF (*.pdf)\|*.pdf\|{ cl_gui_frontend_services=>filetype_all }|
                                                    prompt_on_overwrite = abap_true
                                                  CHANGING
                                                    filename          = lv_filename
                                                    path              = lv_path
                                                    fullpath          = lv_fullpath
                                                    user_action       = lv_action ).

      IF lv_action EQ cl_gui_frontend_services=>action_ok.
* iTab (bytes) -> lokale Datei
        cl_gui_frontend_services=>gui_download( EXPORTING
                                                  filename = lv_fullpath
                                                  filetype = 'BIN'
                                                CHANGING
                                                  data_tab = it_pdf_tline ).
      ENDIF.

    CATCH cx_root INTO DATA(e_txt).
      MESSAGE e_txt->get_text( ) TYPE 'S'.
  ENDTRY.
ENDIF.

Siehe auch: [ABAP] Spoolaufträge (OTF, OTFHPL2, SMART, TEXT) in PDF wandeln

[ABAP] XML-Daten in eine Datei (*.xml) schreiben

Variante 1 (lokal über XML-String)

* ixml Factory
  DATA(o_ixml) = cl_ixml=>create( ).

* Encoding UTF-8
  DATA(o_encoding) = o_ixml->create_encoding( character_set = 'UTF-8'
                                              byte_order = if_ixml_encoding=>co_none ).

* DOM Object Model
  DATA(o_doc) = o_ixml->create_document( ).

  ...

* XML-Dokument rendern
  DATA(o_sf) = o_ixml->create_stream_factory( ).

* XML-String
  DATA: lv_xml TYPE string.

* Stream für Ausgabe in XML-String
  DATA(o_stream) = o_sf->create_ostream_cstring( lv_xml ).
  o_stream->set_encoding( encoding = o_encoding ).
  o_stream->set_pretty_print( pretty_print = abap_true ).

* Render-Objekt
  DATA(o_render) = o_ixml->create_renderer( ostream  = o_stream
                                            document = o_doc ).

* XML-String in lv_xml generieren
  DATA(lv_rc) = o_render->render( ).

* Dateigröße in Bytes
  DATA(lv_size) = o_stream->get_num_written_raw( ).
  
* Stream schließen
  o_stream->close( ).

* Wenn alles ok
  IF lv_rc = 0 AND lv_size > 0.
  * XML-String in XML-Document wandeln
    DATA(o_xml_doc) = NEW cl_xml_document( ).
    o_xml_doc->parse_string( lv_xml ).

  * XML-Document als Datei speichern
    o_xml_doc->export_to_file( 'c:\temp\test.xml' ).
  ENDIF.

Variante 2 (lokal über XML-iTab)

* ixml Factory
  DATA(o_ixml) = cl_ixml=>create( ).

* Encoding UTF-8
  DATA(o_encoding) = o_ixml->create_encoding( character_set = 'UTF-8'
                                              byte_order = if_ixml_encoding=>co_none ).

* DOM Object Model
  DATA(o_doc) = o_ixml->create_document( ).

  ...

* XML-Dokument rendern
  DATA(o_sf) = o_ixml->create_stream_factory( ).

* XML-iTab
  DATA: it_xml_out TYPE STANDARD TABLE OF char255 WITH DEFAULT KEY.

* Encoding UTF-8
  DATA(o_encoding) = o_ixml->create_encoding( character_set = 'UTF-8'
                                              byte_order = if_ixml_encoding=>co_none ).

* Stream für Ausgabe in XML-iTab
  DATA(o_stream) = o_sf->create_ostream_itable( table = it_xml_out ).
  o_stream->set_encoding( encoding = o_encoding ).

* Render-Objekt
  DATA(o_render) = o_ixml->create_renderer( ostream  = o_stream
                                            document = o_doc ).

  o_render->set_normalizing( is_normalizing = space ).

* XML-String in it_xml_out generieren
  DATA(lv_rc) = o_render->render( ).

* Dateigröße in Bytes
  DATA(lv_size) = o_stream->get_num_written_raw( ).
  
* Stream schließen
  o_stream->close( ).

* Wenn alles ok
  IF lv_rc = 0 AND lv_size > 0.
* Tabelle als Binär-Daten herunterladen
    cl_gui_frontend_services=>gui_download( EXPORTING
                                              filename = 'c:\temp\test.xml'
                                              filetype = 'BIN'
                                              bin_filesize = lv_size
                                            CHANGING
                                              data_tab = it_xml_out ).
  ENDIF.

Variante 3 (Applikationsserver)

* ixml Factory
  DATA(o_ixml) = cl_ixml=>create( ).

* DOM Object Model
  DATA(o_doc) = o_ixml->create_document( ).
  
  ...
  
* XML-Dokument rendern
  DATA(o_sf) = o_ixml->create_stream_factory( ).

* Encoding UTF-8
  DATA(o_encoding) = o_ixml->create_encoding( character_set = 'UTF-8'
                                              byte_order = if_ixml_encoding=>co_none ).

* Stream für Ausgabe in Datei '/tmp/test/test.xml' auf dem Applikationsserver
  DATA(o_stream) = o_sf->create_ostream_uri( system_id = '/tmp/test/test.xml' ).
  o_stream->set_encoding( encoding = o_encoding ).
  o_stream->set_pretty_print( pretty_print = abap_true ).

* Render-Objekt
  DATA(o_render) = o_ixml->create_renderer( ostream  = o_stream
                                            document = o_doc ).

* XML-String in Datei auf Applikationsserver generieren
  DATA(lv_rc) = o_render->render( ).

* Dateigröße in Bytes
  DATA(lv_size) = o_stream->get_num_written_raw( ).
  
* Stream schließen
  o_stream->close( ).

* Wenn alles ok
  IF lv_rc = 0 AND lv_size > 0.
    ...
  ENDIF.

[ABAP] IDoc als XML-Datei speichern

PARAMETERS: p_idoc TYPE edi_docnum.

START-OF-SELECTION.

  TRY.
      DATA(o_idoc_xml) = NEW cl_idoc_xml1( docnum = p_idoc ).

      DATA: lv_xml TYPE string.

      o_idoc_xml->get_xmldata_as_string( IMPORTING data_string = lv_xml ).

      DATA(it_xml) = VALUE stringtab( ( |{ lv_xml }| ) ).

      DATA: lv_temp_dir TYPE string.

* Temp-Directory holen
      cl_gui_frontend_services=>get_desktop_directory( CHANGING desktop_directory = lv_temp_dir ).
* Note 1442303, sonst ist lv_temp_dir leer
      cl_gui_cfw=>flush( ).

* Dateinamen zusammenbauen
      DATA(lv_filename) = |{ lv_temp_dir }\\my_xml.xml|.

* Datei im Zielverzeichnis erzeugen
      cl_gui_frontend_services=>gui_download( EXPORTING
                                                filename = lv_filename
                                                filetype = 'ASC'
                                              CHANGING
                                                data_tab = it_xml ).

      WRITE: / lv_filename.
    CATCH cx_root INTO DATA(e_txt).
      WRITE: / e_txt->get_text( ).
  ENDTRY.

[ABAP] VBA-Code ausführen

* VBA-Code
DATA(it_vba_code) = VALUE stringtab( ( |Dim app| )
                                     ( |Set app = CreateObject("Access.Application")| )
                                     ( |Dim msg| )
                                     ( |msg = MsgBox ("My Message.", 0, "Warning")| ) ).

DATA: lv_temp_dir TYPE string.

* Temp-Directory holen
cl_gui_frontend_services=>get_desktop_directory( CHANGING desktop_directory = lv_temp_dir ).
* Note 1442303, sonst ist lv_temp_dir leer
cl_gui_cfw=>flush( ).

* Dateinamen zusammenbauen
DATA(lv_filename) = |{ lv_temp_dir }\\my_script.vbs|.

* Datei im Zielverzeichnis erzeugen
cl_gui_frontend_services=>gui_download( EXPORTING
                                          filename = lv_filename
                                          filetype = 'ASC'
                                        CHANGING
                                          data_tab = it_vba_code ).

LOOP AT it_vba_code ASSIGNING FIELD-SYMBOL(<fs_line>).
  WRITE: / <fs_line>.
ENDLOOP.

SKIP.

WRITE: / lv_filename.

* VBA über Scripting Host ausführen
* "" für lv_filename ergänzen, sonst wird der Pfad unter parameter nicht korrekt übergeben,
* da Leerzeichen im Pfad als Trennung in einzelne Parameter erkannt wird
cl_gui_frontend_services=>execute( application = 'WSCRIPT.EXE'
                                   parameter   = |"{ lv_filename }"| ).

[ABAP] Spoolaufträge (OTF, OTFHPL2, SMART, TEXT) in PDF wandeln

TYPES: BEGIN OF ty_spool,
         rqident   TYPE tsp01-rqident,
         rqtitle   TYPE tsp01-rqtitle,
         rqdest    TYPE tsp01-rqdest,
         rqpaper   TYPE tsp01-rqpaper,
         rqdoctype TYPE tsp01-rqdoctype,
       END OF ty_spool.

* Nr. des Spoolauftrags
PARAMETERS: p_spool TYPE tsp01-rqident OBLIGATORY.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_spool.
  DATA: it_spool TYPE TABLE OF ty_spool.
  DATA: it_return TYPE TABLE OF ddshretval.

  CLEAR: it_spool.

  SELECT rqident, rqtitle, rqdest, rqpaper, rqdoctype FROM tsp01
    INTO CORRESPONDING FIELDS OF TABLE @it_spool
    ORDER BY rqident.

* eigene Suuchhilfe für Auswahl der Spooljobs anzeigen
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield        = 'RQIDENT'     " Spalte der internen Tabelle bei value_tab
      dynpprog        = sy-repid
      dynpnr          = sy-dynnr
      dynprofield     = 'P_SPOOL'     " Name des Dynpro-Feldes für die automatische Werterückgabe
      value_org       = 'S'           " Werteübergabe: C: zellenweise, S: strukturiert
      window_title    = 'Auswahl'
    TABLES
      value_tab       = it_spool      " Übergabe-Tabelle mit Werten für die Anzeige und Auswahl
      return_tab      = it_return     " Rückgabe-Tabelle mit den ausgewählten (geklickten) Elementen
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.

  IF sy-subrc = 0.
    IF lines( it_return ) > 0.
      MESSAGE it_return[ 1 ]-fieldval TYPE 'S'.
    ENDIF.
  ENDIF.

START-OF-SELECTION.
  DATA: lv_tsp01_sel TYPE tsp01.

  SELECT SINGLE * FROM tsp01
    INTO CORRESPONDING FIELDS OF @lv_tsp01_sel
    WHERE rqident = @p_spool.

  IF sy-subrc = 0.
* Dummys für Aufruf von RSPO_RETURN_SPOOLJOB
    DATA: it_otf TYPE STANDARD TABLE OF soli.
    DATA: it_pdf TYPE STANDARD TABLE OF tline.

* Spooljob als iTab holen
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
      EXPORTING
        rqident              = p_spool
        desired_type         = 'RAW' " RAW, ALI, OTF, PDF
      TABLES
        buffer               = it_otf
        buffer_pdf           = it_pdf
      EXCEPTIONS
        no_such_job          = 1
        job_contains_no_data = 2
        selection_empty      = 3
        no_permission        = 4
        can_not_access       = 5
        read_error           = 6
        type_no_match        = 7
        OTHERS               = 8.

    IF sy-subrc <> 0.
      WRITE: 'Spoolauftrag nicht vorhanden: ', sy-subrc.
    ELSE.
      DATA: lv_objtype TYPE rststype-type.
      DATA: lv_type TYPE rststype-type.

* Eigenschaften des TemSe Objektes holen
      CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
        EXPORTING
          authority     = 'SP01'
          client        = lv_tsp01_sel-rqclient
          name          = lv_tsp01_sel-rqo1name
          part          = 1
        IMPORTING
          objtype       = lv_objtype
        EXCEPTIONS
          fb_error      = 1
          fb_rsts_other = 2
          no_object     = 3
          no_permission = 4.

      IF sy-subrc <> 0.
        WRITE: 'Fehler beim Holen der Attribute.', sy-subrc.
      ELSE.
        DATA: numbytes TYPE i.
        DATA: pdfspoolid LIKE tsp01-rqident.
        DATA: jobname TYPE tbtcjob-jobname.
        DATA: jobcount TYPE tbtcjob-jobcount.
        DATA: pdf TYPE STANDARD TABLE OF tline.

* Konvertierung anhand des Typs vornehmen
        CASE lv_objtype.
          WHEN 'OTF' OR 'OTFHPL2' OR 'SMART'.
            CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
              EXPORTING
                src_spoolid              = p_spool
                no_dialog                = ' '
              IMPORTING
                pdf_bytecount            = numbytes
                pdf_spoolid              = pdfspoolid
                btc_jobname              = jobname
                btc_jobcount             = jobcount
              TABLES
                pdf                      = pdf
              EXCEPTIONS
                err_no_otf_spooljob      = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_dstdevice        = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11.

            IF sy-subrc <> 0.
              WRITE: / 'Fehler bei der OTF->PDF Konvertierung:', sy-subrc.
            ELSE.

            ENDIF.

          WHEN 'TEXT'.
            CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
              EXPORTING
                src_spoolid              = p_spool
                no_dialog                = ' '
                get_size_from_format     = 'X'
              IMPORTING
                pdf_bytecount            = numbytes
                pdf_spoolid              = pdfspoolid
                btc_jobname              = jobname
                btc_jobcount             = jobcount
              TABLES
                pdf                      = pdf
              EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11.

            IF sy-subrc <> 0.
              WRITE: / 'Fehler bei der TEXT->PDF Konvertierung: ', sy-subrc.
            ELSE.

            ENDIF.

          WHEN OTHERS.
            WRITE: / 'Verarbeitungsschritt derzeit nicht implementiert:', lv_objtype.
        ENDCASE.

* wenn erfolgreich -> PDF speichern
        IF ( numbytes > 0 ) AND ( NOT pdf IS INITIAL ).
          DATA: lv_action TYPE i.
          DATA: lv_filename TYPE string.
          DATA: lv_fullpath TYPE string.
          DATA: lv_path TYPE string.

          TRY.
              cl_gui_frontend_services=>file_save_dialog( EXPORTING
                                                            default_file_name = |{ p_spool }|
                                                            default_extension   = 'pdf'
                                                            file_filter         = '(*.pdf)|*.pdf|'
                                                          CHANGING
                                                            filename          = lv_filename
                                                            path              = lv_path
                                                            fullpath          = lv_fullpath
                                                            user_action       = lv_action ).

              IF lv_action EQ cl_gui_frontend_services=>action_ok.
                cl_gui_frontend_services=>gui_download( EXPORTING
                                                          filename = lv_fullpath
                                                          filetype = 'BIN'
                                                        CHANGING
                                                          data_tab = pdf ).

* PDF im ECL viewer anzeigen
                DATA(o_viewer) = NEW cl_gui_ecl_viewerbox( ).

* Fullscreen
                o_viewer->set_alignment( alignment = cl_gui_control=>align_at_left + cl_gui_control=>align_at_right + cl_gui_control=>align_at_top + cl_gui_control=>align_at_bottom ).

* PDF öffnen
                o_viewer->open_document( file = CONV #( lv_fullpath )
                                         file_type = 'application/pdf' ).

                WRITE: / |Datei erfolgreich unter { lv_fullpath } gespeichert.|.
              ENDIF.

            CATCH cx_root INTO DATA(e_text).          " Oberklasse für Exceptions abfangen und Kurztext übergeben
              WRITE: / e_text->get_text( ).
          ENDTRY.

        ENDIF.
      ENDIF.
    ENDIF.
  ELSE.
    WRITE: / |Spoolauftrag { p_spool } nicht vorhanden.|.
  ENDIF.

[ABAP] Interne Tabelle als Datei (CSV) auf den lokalen Rechner speichern

DATA: itab TYPE STANDARD TABLE OF string.
DATA: lv_file TYPE string VALUE 'c:\temp\test.txt'.

...
 
TRY.
  cl_gui_frontend_services=>gui_download(
    EXPORTING
      filename = lv_file
      filetype = 'DAT'  " mögliche Filetypen: BIN, ASC, DAT, DBF, WK1, VSS, IBM
      codepage = '4110' " UTF-8 Encoding: 4110, UTF-16 Big Endian : 4102, UTF-16 Little Endian : 4103.    
    CHANGING
      data_tab = itab ).
  CATCH cx_root INTO DATA(e_text).
    MESSAGE e_text->get_text( ) TYPE 'I'.
ENDTRY.

Weiterführende Infos: Link

[ABAP] Beliebige Dateien zu einer Zipdatei hinzufügen

TYPES: BEGIN OF bin_file,                          " Typ für Binärdatei mit Meta-Infos für das Zipfile
         name TYPE string,
         size TYPE i,
         data TYPE solix_tab,
       END OF bin_file.

DATA: lv_filename TYPE string.                     " Dateiname für FileOpen/FileSave
DATA: wa_file TYPE bin_file.                       " Binärdatei mit Meta-Infos für das Zipfile
DATA: it_binfiles TYPE STANDARD TABLE OF bin_file. " unkomprimierter Stream (Tabelle mit Dateien zum Zippen)
DATA: lv_path TYPE string.

START-OF-SELECTION.
* ZIP-Objekt erzeugen
  DATA(o_zip) = NEW cl_abap_zip( ).

  DATA: it_sel_filetab TYPE filetable.
  DATA: ret_code TYPE i.
  DATA: lv_action TYPE i.
* FileOpen-Dialog für Dateiauswahl anzeigen
* Mehrfachselektion möglich
  cl_gui_frontend_services=>file_open_dialog(
    EXPORTING
      window_title            = 'Dateien zum Komprimieren auswählen'
      multiselection          = 'X'
    CHANGING
      file_table              = it_sel_filetab
      rc                      = ret_code    " Anzahl ausgewählte Dateien, -1 bei Fehler
      user_action             = lv_action ).

  IF lv_action = cl_gui_frontend_services=>action_ok.

* Ausgewählte Dateien durchgehen
    LOOP AT it_sel_filetab INTO DATA(wa_sel_file).

      WRITE: / |Datei hinzugefügt: { wa_sel_file-filename }|.

* Dateien auf den Appl.-Server hochladen
      cl_gui_frontend_services=>gui_upload(
        EXPORTING
          filename                = |{ wa_sel_file-filename }|
          filetype                = 'BIN'
        IMPORTING
          filelength              = wa_file-size
        CHANGING
          data_tab                = wa_file-data ).

* Pfad + Dateinamen aufsplitten
      CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
        EXPORTING
          full_name     = wa_sel_file-filename
        IMPORTING
          file_path     = lv_path
          stripped_name = wa_file-name
        EXCEPTIONS
          x_error       = 1
          OTHERS        = 2.

* Datei zum Stream hinzufügen
      APPEND wa_file TO it_binfiles.

    ENDLOOP.

    ULINE.

    DATA: lv_xstring TYPE xstring.
* unkomprimierte Daten zum Zip-File hinzufügen
    LOOP AT it_binfiles INTO wa_file.

* jeden Datei-Stream binär zu xstring wandeln
      CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
        EXPORTING
          input_length = wa_file-size
        IMPORTING
          buffer       = lv_xstring
        TABLES
          binary_tab   = wa_file-data.

      o_zip->add( name = wa_file-name
                  content = lv_xstring ).

    ENDLOOP.

* Daten komprimieren
    DATA(lv_zip) = o_zip->save( ).

    DATA: lv_zip_size TYPE i.
    DATA: it_zip_bin_data TYPE STANDARD TABLE OF raw255.

* xstring mit Zip-Daten zu binär rückwandeln
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer        = lv_zip
      IMPORTING
        output_length = lv_zip_size
      TABLES
        binary_tab    = it_zip_bin_data.

    DATA: lv_dest_filepath TYPE string.

* SaveFile-Dialog aufrufen
    cl_gui_frontend_services=>file_save_dialog(
      EXPORTING
        window_title         = 'Zipdatei speichern'
        file_filter          = '(*.zip)|*.zip|'
      CHANGING
        filename             = lv_filename
        path                 = lv_path
        fullpath             = lv_dest_filepath ).

* Zipdatei vom Appl-Server auf den lokalen Pfad speichern
    cl_gui_frontend_services=>gui_download(
        EXPORTING
          filename                = lv_dest_filepath
          filetype                = 'BIN'
        CHANGING
          data_tab                = it_zip_bin_data
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          not_supported_by_gui    = 22
          error_no_gui            = 23
          OTHERS                  = 24 ).

    IF sy-subrc = 0.
      WRITE: / |Zipdatei erfolgreich unter { lv_dest_filepath } gespeichert.|.
    ELSE.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
  ENDIF.