10-24-2011 8:39 AM
Hello All,
I am using SAP ECC 6.0. I need to download internal table data to .xlsx file.
I tried GUI_DOWNLOAD, all the data are getting transferred to the .xlsx file, but while opening I am getting the below error.
Excel cannot open the file "download.xlsx" because file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.
Though Microsoft office 2007 is installed in my system.
Please help <removed by moderator>.
Edited by: Thomas Zloch on Oct 24, 2011 10:55 AM
10-24-2011 8:52 AM
Have a look at the blog [Microsoft Office 2007 now supported with SAP Office Integration in SAP R/3 4.6C|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/12030] [original link is broken] [original link is broken] [original link is broken] [original link is broken];
Possible solutions ara available in the notes mentioned.
Kesav
10-24-2011 10:43 AM
Hi Sharah,
You can do following to open a file.
1) Download the file and save it on your desktop with extension .xlsx
2) If open directly ; it will give you the error you mentioned
3) To avoid this, please chnage the file extension from xlsx to xls only
4) Open the file successfully
I hope this will help you.
Regards,
Rahul
10-24-2011 11:14 AM
Hi,
Please find the below code to download data into excel file.
DATA: ld_filename TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i.
Display save dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = ' '
DEFAULT_EXTENSION = 'XLS'
default_file_name = 'accountsdata'
INITIAL_DIRECTORY = 'c:\temp\'
CHANGING
filename = ld_filename
path = ld_path
fullpath = ld_fullpath
user_action = ld_result.
Check user did not cancel request
CHECK ld_result EQ '0'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = ld_fullpath
filetype = 'ASC'
APPEND = 'X'
write_field_separator = 'X'
CONFIRM_OVERWRITE = 'X'
TABLES
data_tab = it_datatab[] "need to declare and populate
EXCEPTIONS
file_open_error = 1
file_write_error = 2
OTHERS = 3.
Thanks and Regards
Chitra