<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Simple XML Transformation: Dump on converting several elements into xstring in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-xml-transformation-dump-on-converting-several-elements-into-xstring/m-p/1873374#M367495</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sumansen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do you know how to change in transformation 'ID' encoding from 'utf-16' to 'utf-8' and how can I see this transformation code in general?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Irina&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Jun 2008 14:00:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-16T14:00:09Z</dc:date>
    <item>
      <title>Simple XML Transformation: Dump on converting several elements into xstring</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-xml-transformation-dump-on-converting-several-elements-into-xstring/m-p/1873372#M367493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having troubles to use a simple transformation that creates a byte-string (xstring) as result. It is necessary for me to use a byte-string to have xml in UTF-8 format, because I need to transport data in file format between unicode and non-unicode systems.&lt;/P&gt;&lt;P&gt;I even tried to do things as simple as possible and took the SAP Example for simple transformations and just modified the result type...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* The code of the simple transformation
&amp;lt;?sap.transform simple?&amp;gt;
&amp;lt;tt:transform xmlns:tt="http://www.sap.com/transformation-templates" template="temp1" version="0.1"&amp;gt;
  &amp;lt;tt:root name="PARA1"/&amp;gt;
  &amp;lt;tt:root name="PARA2"/&amp;gt;
  &amp;lt;tt:template name="temp1"&amp;gt;
    &amp;lt;X1&amp;gt;
      &amp;lt;tt:value ref="PARA1"/&amp;gt;
    &amp;lt;/X1&amp;gt;
    &amp;lt;X2&amp;gt;
      &amp;lt;tt:value ref="PARA2"/&amp;gt;
    &amp;lt;/X2&amp;gt;
  &amp;lt;/tt:template&amp;gt;
&amp;lt;/tt:transform&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;
* Simple Transformation with xstring result
DATA xml_string TYPE xstring.
DATA field1(10) TYPE c VALUE 'Field1'.
DATA field2(10) TYPE c VALUE 'Field2'.

CALL TRANSFORMATION zst_demo
  SOURCE para1 = field1
         para2 = field2
  RESULT XML xml_string.

DATA result1 LIKE field1.
DATA result2 LIKE field2.

CALL TRANSFORMATION zst_demo
  SOURCE XML xml_string
  RESULT para1 = result1
         para2 = result2.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When executing the code and using a string as result everything works fine, but when using a xstring I get a dump considering "ST_INVALID_XML" with action "OpenElement". Converting only one data element works fine with an xstring, but when trying to convert 2 parameters I get that dump.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any hints or another post with information on how to solve this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards, Karsten&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Feb 2007 11:46:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-xml-transformation-dump-on-converting-several-elements-into-xstring/m-p/1873372#M367493</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-01T11:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML Transformation: Dump on converting several elements into xstring</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-xml-transformation-dump-on-converting-several-elements-into-xstring/m-p/1873373#M367494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: g_ixml type ref to if_ixml,
        g_stream_factory type ref to if_ixml_stream_factory,
        g_encoding type ref to if_ixml_encoding,
        ostream type ref to if_ixml_ostream.

DATA xml_string TYPE xstring.
DATA field1(10) TYPE c VALUE 'Field1'.
DATA field2(10) TYPE c VALUE 'Field2'.
constants: encoding type string value `utf-8`.

g_ixml = cl_ixml=&amp;gt;create( ).
g_stream_factory = g_ixml-&amp;gt;create_stream_factory( ).
g_encoding = g_ixml-&amp;gt;create_encoding( character_set = encoding
                                                           byte_order = 0 ).

ostream = g_stream_factory-&amp;gt;create_ostream_xstring( string = xml_string ).
ostream-&amp;gt;set_encoding( encoding = g_encoding ).

CALL TRANSFORMATION zst_demo
  SOURCE para1 = field1
                para2 = field2
  RESULT XML ostream.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should work and you will have the xstring result in xml_string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Feb 2007 16:18:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-xml-transformation-dump-on-converting-several-elements-into-xstring/m-p/1873373#M367494</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-05T16:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: Simple XML Transformation: Dump on converting several elements into xstring</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/simple-xml-transformation-dump-on-converting-several-elements-into-xstring/m-p/1873374#M367495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sumansen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do you know how to change in transformation 'ID' encoding from 'utf-16' to 'utf-8' and how can I see this transformation code in general?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Irina&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Jun 2008 14:00:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/simple-xml-transformation-dump-on-converting-several-elements-into-xstring/m-p/1873374#M367495</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-16T14:00:09Z</dc:date>
    </item>
  </channel>
</rss>

