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

Excel issue while download data by using cl_bcs class

sri6666
Active Participant
0 Likes
2,549

Hi all,

i am downloading different lanaguages vendor data by using class cl_bcs into excel sheet . but excel sheet shows

different format data which not actually. if i am download Chinese vendor data... its not showing in chinese language its showing in different format. can any one help me on this.

iam using below FM's for string to xstring and xsting to binary.

'HR_KR_STRING_TO_XSTRING' SPAN

'SCMS_XSTRING_TO_BINARY'

iam folling below code

https://www.sapnuts.com/tutorials/Sending-email-with-attachment-in-SAP-ABAP/singlepage.html

4 REPLIES 4
Read only

Sandra_Rossi
Active Contributor
1,460

If your Excel file is CSV format, then add the Byte Order Mark (BOM) for UTF-16LE :

  TRY.
      l_xstring = cl_bcs_convert=>string_to_xstring(
        EXPORTING
          iv_string     = l_string
          iv_codepage   = '4103' " UTF-16LE
          iv_add_bom    = abap_true ).
    CATCH cx_bcs.
      " handle the error
  ENDTRY.

UTF-16LE is correctly handled by Microsoft Excel historically (better than UTF-8 and UTF-16BE).

Read only

0 Likes
1,460

thanks Roosi,

String_to_solix method working for my scanario.

Read only

1,460

Use the below code,

  TRY.
      cl_bcs_convert=>string_to_solix(
      EXPORTING
      iv_string = l_line
      iv_codepage = '4103' "suitable for MS Excel, leave empty
      iv_add_bom = 'X' "for other doc types
      IMPORTING
      et_solix = gt_binary_content
      ev_size = gv_size ).
    CATCH cx_bcs.
      MESSAGE e445(so).
  ENDTRY.

Read only

0 Likes
1,460

Thanks Solomon,

its working for me.. thanks lot.