2005 Aug 03 6:44 PM
Hello,
Is is possible to create a unicode compliant (UTF-8) XML document in SAP 4.6c ?.
Regards,
Jay
2005 Aug 05 7:38 PM
Thanks a lot Thomas.. It worked fine.
I have another question - please let me know.
I have to download the encoded XML file to app server. But after converting it to a table all entries are in hex format also are there any other ways to download the internal table other then dataset transfer.
Thanks again...
Jay
2005 Aug 03 7:04 PM
Yes - quite possible. Use the iXML libraries just like normal.
However before you render the XML into the output stream (IF_IXML_OSTREAM), tell the OSTREAM that you want to use UTF-8 encoding.
* Encoding is type ref to IF_IXML_ENCODING.
* ENCODING_TYPE is a constant set to value 'UTF-8'.
data: s_encoding_type type string.
clear streamfactory.
streamfactory = ixml->create_stream_factory( ).
s_encoding_type = encoding_type.
encoding = ixml->create_encoding( character_set = s_encoding_type
byte_order = 0 ).
* b_xml is type XSTRING
ostream =
streamfactory->create_ostream_xstring( b_xml ).
call method ostream->set_encoding
exporting encoding = encoding.
call method document->render
exporting ostream = ostream
recursive = 'X'.
2005 Aug 05 7:38 PM
Thanks a lot Thomas.. It worked fine.
I have another question - please let me know.
I have to download the encoded XML file to app server. But after converting it to a table all entries are in hex format also are there any other ways to download the internal table other then dataset transfer.
Thanks again...
Jay
2005 Aug 05 7:46 PM
I always use the Transfer to DATASET to write out the files to the APP Server. It doesn't matter if you send it to the app server (via dataset) or frontend (via GUI_DOWNLOAD); just be sure to use binary transfer.
I send the XML output directly in to a binary string (no internal table). I then send that to the app server as the binary string.
clear ressize.
ressize = ostream->get_num_written_raw( ).
open dataset filename1 for output in
binary mode message message_text.
transfer b_xml to filename1 length ressize.
close dataset filename1.
I'm not sure if there is something eles here you are looking for.
2005 Aug 08 9:36 PM
Hi Thomas,Thanks a lot for all your help. Could you please direct where can find help files for those classes ?.
Thanks again.
Jay
2005 Aug 08 9:41 PM
iXML Library:
http://help.sap.com/saphelp_nw04/helpdata/en/47/b5413acdb62f70e10000000a114084/frameset.htm
Working with Files:
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3c72358411d1829f0000e829fbfe/content.htm
CL_GUI_FRONTEND_SERVICES is document quite well online in SE80.