<?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: Converting hexadecimal XML data to a string in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-hexadecimal-xml-data-to-a-string/m-p/4419163#M1049641</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Martin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to retrieve the XML stream as itab then you could use another method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  CALL METHOD go_xml_doc-&amp;gt;render_2_table
*    EXPORTING
*      pretty_print = 'X'
    IMPORTING
      retcode      = gd_rc
      table          = write_table
*      size         =
      .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Sep 2008 08:14:59 GMT</pubDate>
    <dc:creator>uwe_schieferstein</dc:creator>
    <dc:date>2008-09-03T08:14:59Z</dc:date>
    <item>
      <title>Converting hexadecimal XML data to a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-hexadecimal-xml-data-to-a-string/m-p/4419160#M1049638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Until now I generated XML data with the FM 'SDIXML_DOM_TO_XML'.&lt;/P&gt;&lt;P&gt;After that I did a loop over the xml_as_table in which I was casting each line of that table to a string.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ASSIGN &amp;lt;line&amp;gt; TO &amp;lt;line_c&amp;gt; CASTING.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;After the inftroduction of unicode in our system I get a error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;In the current program an error occured when setting the field symbol &amp;lt;LINE_C&amp;gt; with ASSIGN or ASSIGNING (maybe in combination with the CASTING addition).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When converting the base entry of the field symbol &amp;lt;LINE_C&amp;gt; (number in base table: 32776), it was found that the target type requests a memory alignment of 2&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What does it mean? Does somebody have a solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need this function for sending this XML data as string over a simple old CPIC connection. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2008 17:02:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-hexadecimal-xml-data-to-a-string/m-p/4419160#M1049638</guid>
      <dc:creator>martin_kukielka</dc:creator>
      <dc:date>2008-09-02T17:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: Converting hexadecimal XML data to a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-hexadecimal-xml-data-to-a-string/m-p/4419161#M1049639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Martin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps my sample report &lt;STRONG&gt;ZUS_SDN_XML_XSTRING_TO_STRING&lt;/STRONG&gt; provides a solution for your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZUS_SDN_XML_XSTRING_TO_STRING
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Thread: Converting hexadecimal XML data to a string
*&amp;amp; &amp;lt;a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1029652"&amp;gt;&amp;lt;/a&amp;gt;
*&amp;amp;---------------------------------------------------------------------*

REPORT  zus_sdn_xml_xstring_to_string.

*-- data


*-- read the XML document from the frontend machine
TYPES: BEGIN OF xml_line,
        data(256) TYPE x,
      END OF xml_line.
DATA: xml_table TYPE TABLE OF xml_line.

DATA: go_xml_doc       TYPE REF TO cl_xml_document,
      gd_xml_string    TYPE string,
      gd_rc            TYPE i.

PARAMETERS:
  p_file  TYPE localfile  DEFAULT 'C:payload_idoc.xml'.

START-OF-SELECTION.

  CREATE OBJECT go_xml_doc.
  " Load XML file from PC and get XML itab
  CALL METHOD go_xml_doc-&amp;gt;import_from_file
    EXPORTING
      filename = p_file
    RECEIVING
      retcode  = gd_rc.
  CALL METHOD go_xml_doc-&amp;gt;get_as_table
    IMPORTING
      table   = xml_table
*      size    =
*      retcode =
      .

" NOTE: simulate creation of XML itab

  go_xml_doc-&amp;gt;display( ).


  create object go_xml_doc.
  CALL METHOD go_xml_doc-&amp;gt;parse_table
    EXPORTING
      table   = xml_table
*      size    = 0
    receiving
      retcode = gd_rc.
  CALL METHOD go_xml_doc-&amp;gt;render_2_string
*    EXPORTING
*      pretty_print = 'X'
    IMPORTING
      retcode      = gd_rc
      stream       = gd_xml_string
*      size         =
      .

  write: / gd_xml_string.

END-OF-SELECTION.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2008 22:42:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-hexadecimal-xml-data-to-a-string/m-p/4419161#M1049639</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-09-02T22:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Converting hexadecimal XML data to a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-hexadecimal-xml-data-to-a-string/m-p/4419162#M1049640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Uwe,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just used the last part of your example coding and it works. Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my ready code snipplet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'SDIXML_DOM_TO_XML'
       EXPORTING
            document      = m_document
            pretty_print  = 'X'
       IMPORTING
            xml_as_string = w_string
            size          = w_size
       TABLES
            xml_as_table  = it_xml
       EXCEPTIONS
            no_document   = 1
            OTHERS        = 2.
  IF sy-subrc = 0.
*    WRITE  'ok'.
  ELSE.
    WRITE: 'Err =', sy-subrc.
  ENDIF.

  create object go_xml_doc.
  CALL METHOD go_xml_doc-&amp;gt;parse_table
    EXPORTING
      table   = it_xml
*      size    = 0
    receiving
      retcode = gd_rc.
  CALL METHOD go_xml_doc-&amp;gt;render_2_string
*    EXPORTING
*      pretty_print = 'X'
    IMPORTING
      retcode      = gd_rc
      stream       = gd_xml_string
*      size         =
      .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the string variable &lt;EM&gt;gd_xml_string&lt;/EM&gt; contains the XML stream which I'm able to split into a table.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SPLIT gd_xml_string AT CL_ABAP_CHAR_UTILITIES=&amp;gt;NEWLINE INTO TABLE write_table IN CHARACTER MODE.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Each line of the table is now send over CPIC and it works. &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2008 07:58:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-hexadecimal-xml-data-to-a-string/m-p/4419162#M1049640</guid>
      <dc:creator>martin_kukielka</dc:creator>
      <dc:date>2008-09-03T07:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Converting hexadecimal XML data to a string</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-hexadecimal-xml-data-to-a-string/m-p/4419163#M1049641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Martin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to retrieve the XML stream as itab then you could use another method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  CALL METHOD go_xml_doc-&amp;gt;render_2_table
*    EXPORTING
*      pretty_print = 'X'
    IMPORTING
      retcode      = gd_rc
      table          = write_table
*      size         =
      .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2008 08:14:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-hexadecimal-xml-data-to-a-string/m-p/4419163#M1049641</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-09-03T08:14:59Z</dc:date>
    </item>
  </channel>
</rss>

