Skip to Content
avatar image
Former Member

XML to ABAP internal table using XSLT Transformation:reading XML attribute value also

hi,

i am using XSLT Transformation to convert XML data to ABAP internal table, but able to transform the XML attribute. Please some suggest what I need to change in my XSLT transformation and ABAP structure, bellow is my code:

XSLT:

 ........
<ORGNLTXREF>
	<AMT>
	  <INSTDAMT>
		<xsl:value-of select="TXINFANDSTS/ORGNLTXREF/AMT/INSTDAMT"/>
	  </INSTDAMT>
	</AMT>
	<REQDEXCTNDT>
		<xsl:value-of select="TXINFANDSTS/ORGNLTXREF/REQDEXCTNDT"/>
	</REQDEXCTNDT>
...........

XML:

.......
<OrgnlTxRef>
	<Amt>
	   <InstdAmt Ccy="BGN">1.01</InstdAmt>
	</Amt>
	<ReqdExctnDt>2012-04-23</ReqdExctnDt>
............

I want to read attribute value Ccy in my internal table, please suggest it wil be helpful for me.

I also enclosing my ABAP and XML code for reference.

Thanks,

Atique.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    May 02, 2017 at 09:08 AM

    Not really an SAP question, you could search answers in XSLT or XPATH forums. Answer is: <xsl:value-of select="@Ccy"/> (the exact XPATH value d├ępends on where your "current node" is, of course).

    By the way, XSLT (also ST) is case sensitive (i.e. INSTDAMT is not InstdAmt), so you should adapt accordingly all your XPATH expressions to the exact XML element names.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 03, 2017 at 08:13 AM
    -1

    hi,

    My entire report is working fine and able to get all values in ABAP internal table from the XML file. But new requirement is to read the attribute value also in internal table that is currency value "Ccy" . I have tried with above as suggested but not able to get.

    please suggest if I need to change in ABAP structure and Transformation code.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 04, 2017 at 10:25 AM
    -1

    Thanks Rossi,

    The issue is resolved.

    Add comment
    10|10000 characters needed characters exceeded