Skip to Content
avatar image
Former Member

GUI_DOWNLOAD not writing BOM for UTF-8

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jun 23, 2010 at 01:48 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 23, 2010 at 07:40 AM

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

    Thanks!

    Add comment
    10|10000 characters needed characters exceeded