<?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: Creating an XML From a Deep Structure  using XSL Transformation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-an-xml-from-a-deep-structure-using-xsl-transformation/m-p/7613072#M1569541</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Linda,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    I am replying based on your sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Try the below following suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;   here 'GRPHDR' is the node where I am selecting the data.&lt;/P&gt;&lt;P&gt;           IGRPHDR is the name of the reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First calling the transformation in you program.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

 TYPES: BEGIN OF tl_hdr,
           msgid(20)    TYPE c,
             END OF tl_hdr.
 DATA : t_hdr           TYPE STANDARD TABLE OF tl_hdr.

  GET REFERENCE OF t_hdr INTO l_result_xml-value.
    l_result_xml-name = 'IGRPHDR'.
    APPEND l_result_xml TO t_result_xml.

   TRY.

        CALL TRANSFORMATION yfi_xml_read
        SOURCE XML it_xml_data
        RESULT (t_result_xml).

      CATCH cx_root INTO l_rif_ex.

        l_var_text = l_rif_ex-&amp;gt;get_text( ).
        l_bapiret-type = 'E'.
        l_bapiret-message = l_var_text.
        APPEND l_bapiret TO errormsgs.
        EXIT.
    ENDTRY.
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in XSL transformation&lt;/P&gt;&lt;P&gt;   First write a block of statement to specify from which node you are taking the data.&lt;/P&gt;&lt;P&gt;   No matter it is a node or sub-node.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;lt;xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&amp;gt;
  &amp;lt;xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/&amp;gt;
  &amp;lt;xsl:strip-space elements="*"/&amp;gt;


&amp;lt;xsl:template match="/"&amp;gt;
      &amp;lt;asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"&amp;gt;
      &amp;lt;asx:values&amp;gt;
        &amp;lt;IGRPHDR&amp;gt;  " reference name of internal table
          &amp;lt;xsl:apply-templates select="//GrpHdr"/&amp;gt;
        &amp;lt;/IGRPHDR&amp;gt;
  &amp;lt;/asx:values&amp;gt;
    &amp;lt;/asx:abap&amp;gt;
&amp;lt;/xsl:template&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next select the data from the nodes under the nodes specified in the transformation.&lt;/P&gt;&lt;P&gt;here msgid is the field i am selecting for value.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

&amp;lt;xsl:template match="GrpHdr"&amp;gt;
    &amp;lt;item&amp;gt;
      &amp;lt;MSGID&amp;gt;  " field in the internal table t_hdr where data has to go
        &amp;lt;xsl:value-of select="MsgId"/&amp;gt;
      &amp;lt;/MSGID&amp;gt;
    &amp;lt;/item&amp;gt;
  &amp;lt;/xsl:template&amp;gt;
   &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reply back if further clarification is needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Kannan N&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Jan 2011 15:24:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-01-27T15:24:21Z</dc:date>
    <item>
      <title>Creating an XML From a Deep Structure  using XSL Transformation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-an-xml-from-a-deep-structure-using-xsl-transformation/m-p/7613071#M1569540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ABAPers,&lt;/P&gt;&lt;P&gt;I have a requirement to use XSL Transformations on an ABAP deep type structure.&lt;/P&gt;&lt;P&gt;Currently i have an API that fills in this deep structure and by using CALL TRANSFORMATION ID.... i will get the BIG XML having having 100s of nodes . But actualy form the deep structure i need only some NODES (say 50)... So i tried writing an XSLT &lt;/P&gt;&lt;P&gt;in the transaction STRANS.. but on using this TRANSFORMATION which i wrote i am getting an error messgae like INVALID XML...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am i going in right track or is there a good solution...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My sample transformation is as below...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***********************************************************************************************************************&lt;/P&gt;&lt;P&gt;&amp;lt;xsl:transform version="1.0"&lt;/P&gt;&lt;P&gt;xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;xsl:strip-space elements="*"/&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;xsl:template match="/"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;xsl:value-of select="DATA/NODE_ELEMENTS/UUID_KEY/UUID"/&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;xsl:value-of select="DATA/NODE_ELEMENTS/SEMANTICAL_NAME"/&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;xsl:value-of select="DATA/NODE_ELEMENTS/STRUCT_CAT"/&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;xsl:value-of select="DATA/NODE_ELEMENTS/USAGE_CAT"/&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;xsl:value-of select="DATA/NODE_ELEMENTS/RESTRICTED_IND"/&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;xsl:value-of select="VALUES/DATA/NODE_ID"/&amp;gt;.&lt;/P&gt;&lt;P&gt;&amp;lt;/xsl:template&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/xsl:transform&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***********************************************************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me in solving this issue....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Linda.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Jan 2011 10:24:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-an-xml-from-a-deep-structure-using-xsl-transformation/m-p/7613071#M1569540</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-27T10:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating an XML From a Deep Structure  using XSL Transformation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-an-xml-from-a-deep-structure-using-xsl-transformation/m-p/7613072#M1569541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Linda,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    I am replying based on your sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Try the below following suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;   here 'GRPHDR' is the node where I am selecting the data.&lt;/P&gt;&lt;P&gt;           IGRPHDR is the name of the reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First calling the transformation in you program.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

 TYPES: BEGIN OF tl_hdr,
           msgid(20)    TYPE c,
             END OF tl_hdr.
 DATA : t_hdr           TYPE STANDARD TABLE OF tl_hdr.

  GET REFERENCE OF t_hdr INTO l_result_xml-value.
    l_result_xml-name = 'IGRPHDR'.
    APPEND l_result_xml TO t_result_xml.

   TRY.

        CALL TRANSFORMATION yfi_xml_read
        SOURCE XML it_xml_data
        RESULT (t_result_xml).

      CATCH cx_root INTO l_rif_ex.

        l_var_text = l_rif_ex-&amp;gt;get_text( ).
        l_bapiret-type = 'E'.
        l_bapiret-message = l_var_text.
        APPEND l_bapiret TO errormsgs.
        EXIT.
    ENDTRY.
 &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in XSL transformation&lt;/P&gt;&lt;P&gt;   First write a block of statement to specify from which node you are taking the data.&lt;/P&gt;&lt;P&gt;   No matter it is a node or sub-node.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;lt;xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&amp;gt;
  &amp;lt;xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/&amp;gt;
  &amp;lt;xsl:strip-space elements="*"/&amp;gt;


&amp;lt;xsl:template match="/"&amp;gt;
      &amp;lt;asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"&amp;gt;
      &amp;lt;asx:values&amp;gt;
        &amp;lt;IGRPHDR&amp;gt;  " reference name of internal table
          &amp;lt;xsl:apply-templates select="//GrpHdr"/&amp;gt;
        &amp;lt;/IGRPHDR&amp;gt;
  &amp;lt;/asx:values&amp;gt;
    &amp;lt;/asx:abap&amp;gt;
&amp;lt;/xsl:template&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next select the data from the nodes under the nodes specified in the transformation.&lt;/P&gt;&lt;P&gt;here msgid is the field i am selecting for value.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

&amp;lt;xsl:template match="GrpHdr"&amp;gt;
    &amp;lt;item&amp;gt;
      &amp;lt;MSGID&amp;gt;  " field in the internal table t_hdr where data has to go
        &amp;lt;xsl:value-of select="MsgId"/&amp;gt;
      &amp;lt;/MSGID&amp;gt;
    &amp;lt;/item&amp;gt;
  &amp;lt;/xsl:template&amp;gt;
   &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reply back if further clarification is needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Kannan N&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Jan 2011 15:24:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-an-xml-from-a-deep-structure-using-xsl-transformation/m-p/7613072#M1569541</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-27T15:24:21Z</dc:date>
    </item>
  </channel>
</rss>

