Skip to Content

Exel file corrupted while download using GUI_DOWNLOAD Fm

Hi ABAP Guru,

I am using this FM SO_DOCUMENT_READ_API1 for taking the attachment from IW32 tcode.The PDF and Text file is working fine.But the problem is when file type is .xlsx then using GUI_DOWNLOAD FM giving corrupted file in local system.Please help

CALL FUNCTION 'SO_DOCUMENT_READ_API1'

       EXPORTING

         document_id                = l_doc_id

       IMPORTING

         document_data              = l_doc_data

       TABLES

         object_header              = lt_object_header

         object_content             = lt_object_content

         contents_hex               = lt_contents_hex

       EXCEPTIONS

         document_id_not_exist      = 1

         operation_no_authorization = 2

         x_error                    = 3

         OTHERS                     = 4.

CALL FUNCTION 'GUI_DOWNLOAD'

         EXPORTING

           bin_filesize            = l_bin_filesize

           filename                = l_filename

           filetype                = 'BIN'

         TABLES

           data_tab                = lt_contents_hex[]

         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

           OTHERS                  = 22.


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 26, 2015 at 01:10 PM

    Hi Mazumder,

    Make sure that the file name(l_filename) extension is .'XLS' instead of 'XLSX'.

    Thanks and Regards,

    Girish Kumar V.

    Add comment
    10|10000 characters needed characters exceeded