<?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: transform xml to ABAP in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853919#M1592248</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did exactly what you said but column values are populating at rows(one below the other).If Element index = 0, then col1, if Element index = 1 then col 2.How do I get this output?Can you please help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 May 2011 08:04:23 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-05-09T08:04:23Z</dc:date>
    <item>
      <title>transform xml to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853915#M1592244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an source xml file as shown below.i need the value from tag &amp;lt;DISPLAY_KEY&amp;gt;row2col2&amp;lt;/DISPLAY_KEY&amp;gt; &lt;/P&gt;&lt;P&gt;for every &amp;lt;element index = 0&amp;gt; and &amp;lt;element index = 1&amp;gt; as they refer to rows and cols. Can someone please help getting the data in to internal table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;- &amp;lt;RESULT_SET state="DATA_AVAILABLE"&amp;gt;
- &amp;lt;AXES&amp;gt;
- &amp;lt;AXIS name="ROWS"&amp;gt;
- &amp;lt;TUPLES size="7"&amp;gt;
- &amp;lt;TUPLE&amp;gt;
- &amp;lt;ELEMENT index="0"&amp;gt; -- *row1 col1*  
&amp;lt;DISPLAY_LEVEL&amp;gt;0&amp;lt;/DISPLAY_LEVEL&amp;gt; 
  &amp;lt;DRILL_STATE&amp;gt;LEAF&amp;lt;/DRILL_STATE&amp;gt; 
- &amp;lt;MEMBER name="row1col1" type="MEMBER" text="row1col1"&amp;gt;
- &amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;
  &amp;lt;DISPLAY_KEY&amp;gt;row1col1&amp;lt;/DISPLAY_KEY&amp;gt; 
  &amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;
  &amp;lt;/MEMBER&amp;gt;
  &amp;lt;/ELEMENT&amp;gt;
- &amp;lt;ELEMENT index="1"&amp;gt; -- *row1 col2*  
&amp;lt;DISPLAY_LEVEL&amp;gt;0&amp;lt;/DISPLAY_LEVEL&amp;gt; 
  &amp;lt;DRILL_STATE&amp;gt;LEAF&amp;lt;/DRILL_STATE&amp;gt; 
- &amp;lt;MEMBER name="row1col2" type="MEMBER" text="row1col2"&amp;gt;
- &amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;
  &amp;lt;DISPLAY_KEY&amp;gt;row1col2&amp;lt;/DISPLAY_KEY&amp;gt; 
  &amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;
  &amp;lt;/MEMBER&amp;gt;
  &amp;lt;/ELEMENT&amp;gt;
  &amp;lt;/TUPLE&amp;gt;
- &amp;lt;TUPLE&amp;gt;
- &amp;lt;ELEMENT index="0"&amp;gt;. -- *row2 col1*  
&amp;lt;DRILL_STATE&amp;gt;LEAF&amp;lt;/DRILL_STATE&amp;gt; 
- &amp;lt;MEMBER name="row2col1" type="MEMBER" text="row2col1"&amp;gt;
- &amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;
  &amp;lt;DISPLAY_KEY&amp;gt;row2col1&amp;lt;/DISPLAY_KEY&amp;gt; 
  &amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;
  &amp;lt;/MEMBER&amp;gt;
  &amp;lt;/ELEMENT&amp;gt;
- &amp;lt;ELEMENT index="1"&amp;gt; -- *row2 col2*  
 &amp;lt;DISPLAY_LEVEL&amp;gt;0&amp;lt;/DISPLAY_LEVEL&amp;gt; 
  &amp;lt;DRILL_STATE&amp;gt;LEAF&amp;lt;/DRILL_STATE&amp;gt; 
- &amp;lt;MEMBER name="row2col2" type="MEMBER" text="row2col2"&amp;gt;
- &amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;
  &amp;lt;DISPLAY_KEY&amp;gt;row2col2&amp;lt;/DISPLAY_KEY&amp;gt; 
  &amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;
  &amp;lt;/MEMBER&amp;gt;
  &amp;lt;/ELEMENT&amp;gt;
  &amp;lt;/TUPLE&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Ananda Theerthan on May 6, 2011 11:59 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2011 09:58:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853915#M1592244</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-06T09:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: transform xml to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853916#M1592245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ananda,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can try the below code,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: BEGIN OF t_data,
         display_key TYPE char20,
       END OF t_data.

DATA: input_xml TYPE string,	" Pass the XML string to this
      lt_data   TYPE STANDARD TABLE OF t_data.


TRY.
    CALL TRANSFORMATION zxslt_get_data " Create the XSLT prog using the code given further below
    SOURCE XML input_xml 
    RESULT result_set = lt_data.
  CATCH cx_root.
    WRITE 'Problemo!'.
ENDTRY.

IF sy-subrc EQ 0.

ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code for the XSLT program, create this using Tcode: STRANS&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;lt;xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sap="http://www.sap.com/sapxsl" 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;RESULT_SET&amp;gt;
&amp;lt;xsl:apply-templates select="//TUPLES"/&amp;gt;
&amp;lt;/RESULT_SET&amp;gt;
&amp;lt;/asx:values&amp;gt;
&amp;lt;/asx:abap&amp;gt;
&amp;lt;/xsl:template&amp;gt;
&amp;lt;xsl:template match="TUPLES"&amp;gt;
&amp;lt;xsl:for-each select="TUPLE"&amp;gt;
&amp;lt;DISP&amp;gt;
&amp;lt;DISPLAY_KEY&amp;gt;
&amp;lt;xsl:value-of select="ELEMENT/MEMBER/PRESENTATIONS/DISPLAY_KEY"/&amp;gt;
&amp;lt;/DISPLAY_KEY&amp;gt;
&amp;lt;/DISP&amp;gt;
&amp;lt;/xsl:for-each&amp;gt;
&amp;lt;/xsl:template&amp;gt;
&amp;lt;/xsl:transform&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, i think the XML posted by you was not consistent, below is how i modified the XML content&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;RESULT_SET state="DATA_AVAILABLE"&amp;gt;
&amp;lt;AXES&amp;gt;
&amp;lt;AXIS name="ROWS"&amp;gt;
&amp;lt;TUPLES size="7"&amp;gt;
&amp;lt;TUPLE&amp;gt;
&amp;lt;ELEMENT index="0"&amp;gt;
&amp;lt;DISPLAY_LEVEL&amp;gt;0&amp;lt;/DISPLAY_LEVEL&amp;gt;
&amp;lt;DRILL_STATE&amp;gt;LEAF&amp;lt;/DRILL_STATE&amp;gt;
&amp;lt;MEMBER name="row1col1" type="MEMBER" text="row1col1"&amp;gt;
&amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;
&amp;lt;DISPLAY_KEY&amp;gt;row1col1&amp;lt;/DISPLAY_KEY&amp;gt;
&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;
&amp;lt;/MEMBER&amp;gt;
&amp;lt;/ELEMENT&amp;gt;
&amp;lt;/TUPLE&amp;gt;
&amp;lt;TUPLE&amp;gt;
&amp;lt;ELEMENT index="1"&amp;gt;
&amp;lt;DISPLAY_LEVEL&amp;gt;0&amp;lt;/DISPLAY_LEVEL&amp;gt;
&amp;lt;DRILL_STATE&amp;gt;LEAF&amp;lt;/DRILL_STATE&amp;gt;
&amp;lt;MEMBER name="row1col2" type="MEMBER" text="row1col2"&amp;gt;
&amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;
&amp;lt;DISPLAY_KEY&amp;gt;row1col2&amp;lt;/DISPLAY_KEY&amp;gt;
&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;
&amp;lt;/MEMBER&amp;gt;
&amp;lt;/ELEMENT&amp;gt;
&amp;lt;/TUPLE&amp;gt;
&amp;lt;TUPLE&amp;gt;
&amp;lt;ELEMENT index="0"&amp;gt;
&amp;lt;DRILL_STATE&amp;gt;LEAF&amp;lt;/DRILL_STATE&amp;gt;
&amp;lt;MEMBER name="row2col1" type="MEMBER" text="row2col1"&amp;gt;
&amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;
&amp;lt;DISPLAY_KEY&amp;gt;row2col1&amp;lt;/DISPLAY_KEY&amp;gt;
&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;
&amp;lt;/MEMBER&amp;gt;
&amp;lt;/ELEMENT&amp;gt;
&amp;lt;/TUPLE&amp;gt;
&amp;lt;TUPLE&amp;gt;
&amp;lt;ELEMENT index="1"&amp;gt;
&amp;lt;DISPLAY_LEVEL&amp;gt;0&amp;lt;/DISPLAY_LEVEL&amp;gt;
&amp;lt;DRILL_STATE&amp;gt;LEAF&amp;lt;/DRILL_STATE&amp;gt;
&amp;lt;MEMBER name="row2col2" type="MEMBER" text="row2col2"&amp;gt;
&amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;
&amp;lt;DISPLAY_KEY&amp;gt;row2col2&amp;lt;/DISPLAY_KEY&amp;gt;
&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;
&amp;lt;/MEMBER&amp;gt;
&amp;lt;/ELEMENT&amp;gt;
&amp;lt;/TUPLE&amp;gt;
&amp;lt;/TUPLES&amp;gt;
&amp;lt;/AXIS&amp;gt;
&amp;lt;/AXES&amp;gt;
&amp;lt;/RESULT_SET&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the best!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2011 10:55:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853916#M1592245</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-06T10:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: transform xml to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853917#M1592246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for the help.Your code works great except that it fetches values only from the first element.I think the loop needs to be done for &amp;lt;ELEMENT&amp;gt; as well.Can you please let me know how to acheive this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find below the XML string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;- &amp;lt;RESULT_SET state="DATA_AVAILABLE"&amp;gt;
- &amp;lt;AXES&amp;gt;
- &amp;lt;AXIS name="ROWS"&amp;gt;
- &amp;lt;TUPLES size="7"&amp;gt;
- &amp;lt;TUPLE&amp;gt;
- &amp;lt;ELEMENT index="0"&amp;gt;
  &amp;lt;DISPLAY_LEVEL&amp;gt;0&amp;lt;/DISPLAY_LEVEL&amp;gt; 
  &amp;lt;DRILL_STATE&amp;gt;LEAF&amp;lt;/DRILL_STATE&amp;gt; 
- &amp;lt;MEMBER name="i1" type="MEMBER" text="i1"&amp;gt;
- &amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;
  &amp;lt;DISPLAY_KEY&amp;gt;r1&amp;lt;/DISPLAY_KEY&amp;gt; 
  &amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;
  &amp;lt;/MEMBER&amp;gt;
  &amp;lt;/ELEMENT&amp;gt;
- &amp;lt;ELEMENT index="1"&amp;gt;
  &amp;lt;DISPLAY_LEVEL&amp;gt;0&amp;lt;/DISPLAY_LEVEL&amp;gt; 
  &amp;lt;DRILL_STATE&amp;gt;LEAF&amp;lt;/DRILL_STATE&amp;gt; 
- &amp;lt;MEMBER name="c1" type="MEMBER" text="c1"&amp;gt;
- &amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;
  &amp;lt;DISPLAY_KEY&amp;gt;c1&amp;lt;/DISPLAY_KEY&amp;gt; 
  &amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;
  &amp;lt;/MEMBER&amp;gt;
  &amp;lt;/ELEMENT&amp;gt;
  &amp;lt;/TUPLE&amp;gt;
- &amp;lt;TUPLE&amp;gt;
- &amp;lt;ELEMENT index="0"&amp;gt;
  &amp;lt;DISPLAY_LEVEL&amp;gt;0&amp;lt;/DISPLAY_LEVEL&amp;gt; 
  &amp;lt;DRILL_STATE&amp;gt;LEAF&amp;lt;/DRILL_STATE&amp;gt; 
- &amp;lt;MEMBER name="r2" type="MEMBER" text="r2"&amp;gt;
- &amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;
  &amp;lt;DISPLAY_KEY&amp;gt;r2&amp;lt;/DISPLAY_KEY&amp;gt; 
  &amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;
  &amp;lt;/MEMBER&amp;gt;
  &amp;lt;/ELEMENT&amp;gt;
- &amp;lt;ELEMENT index="1"&amp;gt;
  &amp;lt;DISPLAY_LEVEL&amp;gt;0&amp;lt;/DISPLAY_LEVEL&amp;gt; 
  &amp;lt;DRILL_STATE&amp;gt;LEAF&amp;lt;/DRILL_STATE&amp;gt; 
- &amp;lt;MEMBER name="c2" type="MEMBER" text="c2"&amp;gt;
- &amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;
  &amp;lt;DISPLAY_KEY&amp;gt;c2&amp;lt;/DISPLAY_KEY&amp;gt; 
  &amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;
  &amp;lt;/MEMBER&amp;gt;
  &amp;lt;/ELEMENT&amp;gt;
  &amp;lt;/TUPLE&amp;gt;
  &amp;lt;/TUPLES&amp;gt;
  &amp;lt;/AXIS&amp;gt;
&amp;lt;/AXES&amp;gt;&amp;lt;/RESULT_SET&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Ananda Theerthan on May 9, 2011 8:53 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Ananda Theerthan on May 9, 2011 8:54 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 06:51:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853917#M1592246</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-09T06:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: transform xml to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853918#M1592247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ananda,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You just need to add another loop at the "ELEMENT" node, and change the access path for the DISPLAY_KEY value select.&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"
xmlns:sap="http://www.sap.com/sapxsl" 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;RESULT_SET&amp;gt;
&amp;lt;xsl:apply-templates select="//TUPLES"/&amp;gt;
&amp;lt;/RESULT_SET&amp;gt;
&amp;lt;/asx:values&amp;gt;
&amp;lt;/asx:abap&amp;gt;
&amp;lt;/xsl:template&amp;gt;
&amp;lt;xsl:template match="TUPLES"&amp;gt;
&amp;lt;xsl:for-each select="TUPLE"&amp;gt;
&amp;lt;xsl:for-each select="ELEMENT"&amp;gt; " Additional loop for Node Element
&amp;lt;DISP&amp;gt;
&amp;lt;DISPLAY_KEY&amp;gt;
&amp;lt;xsl:value-of select="MEMBER/PRESENTATIONS/DISPLAY_KEY"/&amp;gt; "Changed access path
&amp;lt;/DISPLAY_KEY&amp;gt;
&amp;lt;/DISP&amp;gt;
&amp;lt;/xsl:for-each&amp;gt;
&amp;lt;/xsl:for-each&amp;gt;
&amp;lt;/xsl:template&amp;gt;
&amp;lt;/xsl:transform&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 07:14:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853918#M1592247</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-09T07:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: transform xml to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853919#M1592248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did exactly what you said but column values are populating at rows(one below the other).If Element index = 0, then col1, if Element index = 1 then col 2.How do I get this output?Can you please help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 08:04:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853919#M1592248</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-09T08:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: transform xml to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853920#M1592249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ananda,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change the local type structure as below,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: BEGIN OF t_data,
         display_key_0 TYPE char20,
         display_key_1 TYPE char20,
       END OF t_data.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;try with the below XSLT program, this should work,&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"
xmlns:sap="http://www.sap.com/sapxsl" 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;RESULT_SET&amp;gt;
&amp;lt;xsl:apply-templates select="//TUPLES"/&amp;gt;
&amp;lt;/RESULT_SET&amp;gt;
&amp;lt;/asx:values&amp;gt;
&amp;lt;/asx:abap&amp;gt;
&amp;lt;/xsl:template&amp;gt;
&amp;lt;xsl:template match="TUPLES"&amp;gt;
&amp;lt;xsl:for-each select="TUPLE"&amp;gt;
&amp;lt;DISP&amp;gt;
&amp;lt;xsl:for-each select="ELEMENT"&amp;gt;
&amp;lt;xsl:choose&amp;gt;
&amp;lt;xsl:when test="@index = 0"&amp;gt;
&amp;lt;DISPLAY_KEY_0&amp;gt;
&amp;lt;xsl:value-of select="MEMBER/PRESENTATIONS/DISPLAY_KEY"/&amp;gt;
&amp;lt;/DISPLAY_KEY_0&amp;gt;
&amp;lt;/xsl:when&amp;gt;
&amp;lt;xsl:when test="@index = 1"&amp;gt;
&amp;lt;DISPLAY_KEY_1&amp;gt;
&amp;lt;xsl:value-of select="MEMBER/PRESENTATIONS/DISPLAY_KEY"/&amp;gt;
&amp;lt;/DISPLAY_KEY_1&amp;gt;
&amp;lt;/xsl:when&amp;gt;
&amp;lt;xsl:otherwise&amp;gt;
&amp;lt;/xsl:otherwise&amp;gt;
&amp;lt;/xsl:choose&amp;gt;
&amp;lt;/xsl:for-each&amp;gt;
&amp;lt;/DISP&amp;gt;
&amp;lt;/xsl:for-each&amp;gt;
&amp;lt;/xsl:template&amp;gt;
&amp;lt;/xsl:transform&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Chen K V on May 9, 2011 4:19 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 10:12:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853920#M1592249</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-09T10:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: transform xml to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853921#M1592250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Chen.That piece of code solved my problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 May 2011 06:39:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/transform-xml-to-abap/m-p/7853921#M1592250</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-10T06:39:29Z</dc:date>
    </item>
  </channel>
</rss>

