‎2009 Sep 15 8:10 PM
Hi all,
I need your help. I am using the FM 'WS_EXCEL' to download an internal table into an excel file. This FM creates the excel file and then automatically opens the file.
Here is the simple code that I'm using:
DATA: v_filename LIKE ibipparms-path.
v_filename = 'C:\My Documents\groupkey.xls'.
CALL FUNCTION 'WS_EXCEL'
EXPORTING
filename = v_filename
TABLES
data = i_rptd.
The file is being successfuly saved in the following path 'C:\My Documents\groupkey.xls'. However, when the FM tries to open the file it looks like is having problem with the space between 'My Documents', becuase I am getting the following 2 Windows error messages:
1. 'C:\My.xls' could not be found. Check the spelling of the file name, and verify that the file location is correct.
2. 'Documents\groupkey.xls' could not be found. Check the spelling of the file name, and verify that the file location is correct.
Note: If I change the path to 'C:\groupkey.xls' is working fine. But the user wants to save the file in 'My Documents' folder.
Any help is greatly appreciated.
Thanks,
Francisco
‎2009 Sep 15 8:30 PM
Try this way
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = v_filename
CHANGING
DATA_TAB = i_rptd[].
then call
CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
EXPORTING
DOCUMENT = v_filename.
a®
‎2009 Sep 15 8:30 PM
Try this way
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = v_filename
CHANGING
DATA_TAB = i_rptd[].
then call
CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
EXPORTING
DOCUMENT = v_filename.
a®
‎2009 Sep 15 10:12 PM
a®s thanks for your help!
This was my final code:
DATA: v_filename type STRING.
v_filename = 'C:My Documentsgroupkey.xls'.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = v_filename
FILETYPE = 'DAT'
CONFIRM_OVERWRITE = 'X'
CHANGING
DATA_TAB = i_rptd[].
CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
EXPORTING
DOCUMENT = v_filename.
‎2009 Sep 16 6:32 AM
Hi,
Don't use function module WS_EXCEL.
use function module GUI_DOWNLOAD & make the file extension '.xls'.
Or you can try using FM : SAP_CONVERT_TO_XLS_FORMAT
Regards,
Tutun