Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

GUI_DOWNLOAD and codepage problem

Former Member
0 Likes
1,539

I'm trying to download XML data using this function module to a local PC file. It contains finnish characters such as Ä.

When I open the XML file with an XML editor, it tells me that "Byte 0xFF found in file ... is invalid for encoding utf-8'

I think I need to save the file with ISO-8859-9 encoding, but I tried to use a codepage for that in the function module, and that also didn't work.

Can anybody suggest what I may be doing wrong?


  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                = l_filename
      filetype                = 'BIN'
      write_lf                = ' '
*     codepage                = '1611'
    TABLES
      data_tab                = lt_table.

I'm trying to download XML data using this function module to a local PC file. It contains finnish characters such as Ä.

When I open the XML file with an XML editor, it tells me that "Byte 0xFF found in file ... is invalid for encoding utf-8'

I think I need to save the file with ISO-8859-9 encoding, but I tried to use a codepage for that in the function module, and that also didn't work.

Can anybody suggest what I may be doing wrong?


  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                = l_filename
      filetype                = 'BIN'
      write_lf                = ' '
*     codepage                = '1611'
    TABLES
      data_tab                = lt_table.

3 REPLIES 3
Read only

Former Member
0 Likes
856

Try using the following method:

TRY.

cl_bcs_convert=>string_to_solix(

EXPORTING

iv_string = lv_string

iv_codepage = '1611'

iv_add_bom = 'X'

IMPORTING

et_solix = binary_content

ev_size = size ).

CATCH cx_bcs.

MESSAGE e445(so).

ENDTRY.

For your table run it for every line and append the lines of the 'binary_content' into a collecting table (binary_content_all or something). Play with the BOM (Byte order mark) to see if you need it or not. After the table has been processed you can download the binary_content_all with your function module but I recommend using:

CALL METHOD cl_gui_frontend_services=>gui_download

EXPORTING

filename = l_filename

filetype = 'BIN'

CHANGING

data_tab = binary_content

Let me know if this was helpful!

Cheers,

Roel van den Berge

Read only

Former Member
0 Likes
856

Try with file type as ASC

Read only

0 Likes
856

I did, it created other problems.