Hi,
I have a problem.
I have a text with the Danish Ø in an ITAB. When convert the file to a xstring and add this XString to an attachment in a pi proxy message it seems to be UTF-8.
I have seen the XSTRING contain an ENCODING property, but I'm unable to figure out how to set up the encoding.
I have the following code.
DATA: begin of itabline occurs 0, text(300) type c, end of itabline. data: attach_xstring TYPE xstring. CALL FUNCTION 'SCMS_TEXT_TO_XSTRING' IMPORTING BUFFER = attach_xstring TABLES TEXT_TAB = itab. attachment_protocol ?= cl_prxy_ordre_data->get_protocol( if_wsprotocol=>ATTACHMENTS ). attachment = attachment_protocol->GET_ATTACHMENT_FROM_BINARY( data = attach_xstring type = if_ai_attachment=>C_MIMETYPE_TEXT_PLAIN name = 'FILE' ).
I don't know if it's exactly in the same case, but I've had some troubles with these functions SCMC with unicode.
Here is a sample of the changes I've done.
* RAW 1022 ==> CHAR 1024 is not possible with SX_TABLE_LINE_WIDTH_CHANGE * RAW 1024 to RAW 1022 * types: t_1022 type x LENGTH 1022, t_1024 type x LENGTH 1024. field-SYMBOLS: <fs_converter> TYPE t_1022. "1022 data: l_xtr type xstring, l_xtr2 type xstring, ls_RAW type SDOKCNTBIN. loop at DOC_BINARY into ls_raw. ASSIGN ls_raw-line to <fs_converter> CASTING. * l_xtr = <fs_converter>. concatenate l_xtr <fs_converter> into l_xtr IN BYTE MODE. endloop. data: l_binary_size type i, l_i type i, l_pos type i, l_bin_len type i value '1024', l_binary type t_1024, t_raw TYPE TABLE OF tbl1024. * field-symbols: <binary> type x. l_binary_size = xstrlen( l_xtr ). * l_i = ( l_binary_size + l_bin_len - 1 ) div l_bin_len. ** assign h_ixos_data-lines to <binary> type 'X'. ** if sy-subrc = 4. ** assign component 0 of structure h_ixos_data to <binary> type 'X'. ** endif. * do l_i times. * l_binary = l_xtr+l_pos. * l_pos = l_pos + l_bin_len. * append l_binary to t_raw. * enddo. CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' EXPORTING BUFFER = l_xtr * APPEND_TO_TABLE = ' ' * IMPORTING * OUTPUT_LENGTH = TABLES BINARY_TAB = t_raw .
I converted to use the PI as conversion for the UNICODE. It seems to work.
Add a comment