Hi Everyone,
I have a requirement where I have to change the file name, while exporting ALV to excel sheet.
By default file name is 'Export.XLSX', I have to change it.
Is it possible?
Also, When I am exporting my internal table into Excel, using the below mentioned code, I always get the following warning ''The file format and extension don't match ''.
LOOP AT lt_comp_dtls INTO ls_comp_dtls.
CONCATENATE ls_comp_dtls-pernr
ls_comp_dtls-name
ls_comp_dtls-div_desc
ls_comp_dtls-div1_desc
ls_comp_dtls-org
ls_comp_dtls-cost_c
ls_comp_dtls-job_ttl
ls_comp_dtls-ch_nch
ls_comp_dtls-mandt_assigned
ls_comp_dtls-mandt_due
ls_comp_dtls-mandt_complete
ls_comp_dtls-duelt30days
ls_comp_dtls-duege30days
ls_comp_dtls-emp_email
ls_comp_dtls-sup_name
ls_comp_dtls-sup_email
ls_comp_dtls-pers_admin
cl_abap_char_utilities=>newline INTO lv_text1
SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
CONCATENATE lv_text_full lv_text lv_text1 INTO lv_text_full.
CALL FUNCTION 'SDOK_MIMETYPE_GET'
EXPORTING
extension = '.XLS'
IMPORTING
mimetype = lv_mime.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = lv_text_full
IMPORTING
buffer = lv_xtext.
CALL METHOD cl_wd_runtime_services=>attach_file_to_response
EXPORTING
* i_filename = 'Download.xls'
i_filename = lv_filename
i_content = lv_xtext
i_mime_type = lv_mime_str "'EXCEL'
i_in_new_window = abap_false
i_inplace = abap_false.
Please provide your valuable suggestions on this.
Thanks,
Faraz Khan