Application Development 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: 

GUI_DOWNLOAD not writing BOM for UTF-8

Former Member
0 Kudos

We are using the following code to produce an Excel Spreadsheet. But the parameter WRITE_BOM is not working - SAP does not write a byte-order mark to the file. The result is that Excel does not open the file correctly. When we add the BOM manually in UltraEdit the file opens correctly.


  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename              = 'C:\export.xls'
      filetype              = 'DAT'
      trunc_trailing_blanks = 'X'
      write_field_separator = 'X'
      codepage              = '4310'
      write_bom             = 'X'
    TABLES
      data_tab              = gt_textsi
    EXCEPTIONS

1 ACCEPTED SOLUTION

pole_li
Active Participant
0 Kudos

Please check the function help:

Short Text

     If set, writes a Unicode byte order mark

 Description

     If data is written in a Unicode codepage, at the top of the file the
     respective byte order mark (BOM) is included.

     Unicode - Little Endian codepage 4103, binary values 'FFFE'

     Unicode - Big Endian codepage 4102, binary values 'FEFF'

     UTF-8 codepage 4110, binary values 'EFBBBF'

     Note: Microsoft Excel supports Unicode data only if they have been
     written in Unicode - Little Endian format.

2 REPLIES 2

pole_li
Active Participant
0 Kudos

Please check the function help:

Short Text

     If set, writes a Unicode byte order mark

 Description

     If data is written in a Unicode codepage, at the top of the file the
     respective byte order mark (BOM) is included.

     Unicode - Little Endian codepage 4103, binary values 'FFFE'

     Unicode - Big Endian codepage 4102, binary values 'FEFF'

     UTF-8 codepage 4110, binary values 'EFBBBF'

     Note: Microsoft Excel supports Unicode data only if they have been
     written in Unicode - Little Endian format.

Former Member
0 Kudos

That was it! I had the wrong codepage. Correct is '4103'.

Thanks!