Skip to Content
0
Feb 17, 2015 at 07:34 AM

Issue with BYTE ORDER MARK file

1125 Views


Hi experts,

I am facing one issue. My user wants file with UTF8 with byte order mark. I am working on SAP 4.7

so syntex 'Open dataset..encoding UTF-8... with byte order mark' is giving error. so what i did

i just converted the string to Xsring , i added byte order mark in starting and again converted that xstring to string.

below is my code

app_type = 'text/plain; charset=utf-8'.

LOOP AT i_server INTO lw_server.

**************************************

CLEAR xs_content.

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

EXPORTING

text = lw_server-string

mimetype = app_type

IMPORTING

buffer = xs_content.

CONCATENATE cl_abap_char_utilities=>byte_order_mark_utf8

xs_content INTO xs_content IN BYTE MODE.

CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'

EXPORTING

from_codepage = '4110'

in_xstring = xs_content

* OUT_LEN =

IMPORTING

out_string = text_buffer

.

transfer text_bueffer to l_server.

endloop.

now issue is that string should be like this

4260#1001300029#####;#;#;#;# (here # - space)

but it is coming like that

4 260#1001300029#####;#;#;#;#

automatically space type thing is getting inserted between.

May be this is due to byte order mark. its very strange.

if anybody has any idea please help me.

Regards,

Ashish