‎2008 May 05 2:21 PM
Hi all!
I'm using a SIMPLE TRANSFORMATION to generate an XML file that is sent to a legacy system. After the CALL TRANSFORMATION statement, I get the XML string, but it starts with:
<?xml version="1.0" encoding="utf-16"?>
My legacy system can read only UTF-8, so I need to change the encoding.
Reward points wait for the solver
This is my code:
CALL TRANSFORMATION zpp_transm_eol_f1a
SOURCE cin = ls_zf1a-vehicle_id_numb
RESULT XML gs_f1a_file_xml.
and this is the transformation:
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="CIN"/>
<tt:template>
<Assemblies>
<Assembly>
<UniqueNumber>
<tt:value ref="CIN"/>
</UniqueNumber>
</Assembly>
</Assemblies>
</tt:template>
</tt:transform>
‎2008 May 07 9:16 AM
I found the solution and want to share with all:
when you use CALL TRANSACTION statement, the XML string is encoded in UTF-16 or UTF-8 dependig by the type of the string itself. I mean:
1) this will be UTF-16:
data return_string type STRING.
call transformation my_transform
source ......
result xml return_string.
2) this will be UTF-8:
data return_string type XSTRING.
call transformation my_transform
source ......
result xml return_string.
Hope this will help sameone.
‎2008 May 07 9:16 AM
I found the solution and want to share with all:
when you use CALL TRANSACTION statement, the XML string is encoded in UTF-16 or UTF-8 dependig by the type of the string itself. I mean:
1) this will be UTF-16:
data return_string type STRING.
call transformation my_transform
source ......
result xml return_string.
2) this will be UTF-8:
data return_string type XSTRING.
call transformation my_transform
source ......
result xml return_string.
Hope this will help sameone.
‎2011 Dec 22 2:19 PM
‎2011 Dec 22 3:26 PM
Thanks for sharing the solution, I actually had this problem before, in my case the middle ware supports UTF-16 so I left it as it is, but I never figured it out.