‎2006 Jan 09 12:57 PM
Hi,
See the below code and can any one pls tell me what is that i writing wrong here. What i want to do is If the check box is checked, i want to download the data to excel sheet.
also tell me if there are any other parameters to be filled in the function module.
DATA: v_file type string.
DATA : BEGIN OF it_excelhead OCCURS 0,
colname(40),
END OF it_excelhead.
PARAMETER: p_check AS CHECKBOX DEFAULT ' ',
p_file LIKE rlgrap-filename DEFAULT 'c:'.
IF p_check = 'X'.
PERFORM prepare_excel_header.
MOVE p_file TO v_file.
CONCATENATE p_file '.xls' INTO v_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = v_file
FILETYPE = 'ASC'
tables
data_tab = i_final1
FIELDNAMES = it_excelhead.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endif.
‎2006 Jan 09 1:03 PM
Hi,
Please change <b>the 'ASC' to 'BIN'.</b>Hope This Info Helps YOU.
<i>Reward Points If It Helps YOU.</i>
Regards,
Raghav
IF p_check = 'X'.
PERFORM prepare_excel_header.
MOVE p_file TO v_file.
CONCATENATE p_file '.xls' INTO v_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = v_file
FILETYPE = 'BIN'
tables
data_tab = i_final1
FIELDNAMES = it_excelhead.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endif.
‎2006 Jan 09 1:05 PM
Why don't you use fm XXL_SIMPLE_API?
Fo XL files this is the best
‎2006 Jan 09 1:05 PM
Hi Hema,
you have build a flat file,
try to put a txt extension and open it with a txt editor.
for creating an excel file there is a fm.
As soon as i put it there,
bye
enzo
‎2006 Jan 09 1:09 PM
Hi ,
Please use below FM to download data
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
EXPORTING
FILE_NAME = LV_FILE1
DATA_SHEET_NAME = 'SUMMARY'
TABLES
DATA_TAB = IT_EXCEL_SUMMARY
EXCEPTIONS
FILE_NOT_EXIST = 1
FILENAME_EXPECTED = 2
COMMUNICATION_ERROR = 3
OLE_OBJECT_METHOD_ERROR = 4
OLE_OBJECT_PROPERTY_ERROR = 5
INVALID_FILENAME = 6
INVALID_PIVOT_FIELDS = 7
DOWNLOAD_PROBLEM = 8
OTHERS = 9.
IF SY-SUBRC <> 0.
ENDIF.
ENDIF.
Reward points If information is helpful
Regards
Amole
‎2006 Jan 09 1:11 PM
HI.
try this FM.
MS_EXCEL_OLE_STANDARD_DAT .
In this FM, the header can also be given separately.
Thanks,
Maheshwari.V
‎2006 Jan 09 1:24 PM
Hi i dont think using gui_download is a good option for handling Excel file.
Try this one out: <b>SAP_CONVERT_TO_XLS_FORMAT</b>
‎2006 Jan 09 2:19 PM
Hi Hema,
Pass the exporting parameter WRITE_FIELD_SEPARATOR as 'X' for GUI_DOWNLOAD and it should work...
Regards,
Srikanth