2022 Aug 25 3:30 PM
Hello,
I have an xml string variable like that contains spcecial characteres like "ñ" i try to to convert to UTF-8 and save it but when I do that I cannot see the values of the XML. please see my example code:
DATA: lv_e_utf8 TYPE xstring,
lv_i_keep_trailing_blanks TYPE xfeld,
lv_i_xml TYPE string,
lv_other TYPE c.
<br>
DATA: v_length TYPE i,
v_base64 TYPE string. DATA: it_xml_tempo TYPE string OCCURS 0 WITH HEADER LINE,
it_temporal TYPE string OCCURS 0 WITH HEADER LINE.
lv_i_xml = '<inicio><nombre>Luis Ñañamito</nombre></inicio>'.
DATA: lv_ruta TYPE string.
CONCATENATE 'c:/complemento/'
'PRUEBA.xml' INTO lv_ruta.
CLEAR: it_xml_tempo. REFRESH: it_xml_tempo. FREE: it_xml_tempo. APPEND lv_i_xml TO it_xml_tempo. DATA: V_UTF8 TYPE XSTRING.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = lv_i_xml
* MIMETYPE = ' '
ENCODING = '4110'
IMPORTING<br>
BUFFER = V_UTF8
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
APPEND V_UTF8 TO it_temporal.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING<br>
filename = lv_ruta
filetype = 'ASC'
TABLES<br>
data_tab = it_temporal. "it_xml_tempo.
When I save my field and open I only see:
What I need to do to convert my xml file into UTF-8 format to d
2022 Aug 25 4:25 PM
Function module GUI_DOWNLOAD is obsolete.
Replaced with method GUI_DOWNLOAD of CL_GUI_FRONTEND_SERVICES.
About the parameter FILETYPE, keep consistency, you should never mix characters with bytes, and bytes with characters (except when encoding/decoding):
XSTRING = bytes = BINary
STRING = characters = ASCii
2024 Mar 04 10:56 PM
I'll appreciate you can share the solution you found, as we are facing same issue.
Thank you !