GUI Download Chinese Character to Excel gibberish character
I'm facing a problem where I'm using FM gui_download to save Chinese Character into Excel file.
Upon double click to open the excel file, funny character shows up.
But if I were to open the same file using a blank Ms Excel application (Go to File->Open->choose file),
Excel will prompt me to select a proper encoding (GB2312 in this case), and the Chinese character can be seen thereafter.
But, my user doesn't want to go through this.
I've browsed through the forum and someone has posted about this before and it's unanswered.
And, GUI_DOWNLOAD give 2 bytes for each chinese character - I need fixed length which is not related to my problem.
Below is my code:
DATA: lv_codepage TYPE cpcodepage,
lv_char_cpage TYPE abap_encod,
lv_encoding TYPE abap_encod.
Get Code Page for Chinese Character Spras = '1' or 'ZH'
CALL FUNCTION 'NLS_GET_FRONTEND_CP'
langu = '1' " Chinese Simplified Table T002
fetype = 'MS' " Manufacturer is Microsoft Table TCP05
frontend_codepage = lv_codepage
illegal_syst_codepage = 1
no_frontend_cp_found = 2
internal_or_db_error = 3
OTHERS = 4.
Conversion c(4) = n(10)
lv_char_cpage = lv_codepage.
CALL FUNCTION 'GUI_DOWNLOAD'
filename = p_file
filetype = 'DAT' "tried ASC and not working as well
codepage = lv_char_cpage "8404 in this case tried 8400 and same result
replacement = '#'
write_field_separator = 'X'
data_tab = i_data_cnvr "table content
fieldnames = i_data_head "table header
Please help. Does this has something to do with utf-8 encoding?