Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Exel file corrupted while download using GUI_DOWNLOAD Fm

palash_mazumder
Participant
0 Kudos

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.


1 ACCEPTED SOLUTION

0 Kudos

Hi Mazumder,

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

Thanks and Regards,

Girish Kumar V.

4 REPLIES 4

0 Kudos

Hi Mazumder,

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

Thanks and Regards,

Girish Kumar V.

0 Kudos

Hi Girish

The file name extension is .XLSX

0 Kudos

Hi Mazumder,

In some systems it wont accepts 'XLSX' extensions based on MS office versions,The file may be download to the specified locations but some times it may not opens gives us an error that the file was corrupted.

Try using the extension '.XLS'. I hope it will work.

Thanks and Regards,

Girish Kumar V.

0 Kudos

Thanks Girish,,

Some how my problem is solved