Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

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

0 Kudos

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.

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor

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.

3 REPLIES 3

Sandra_Rossi
Active Contributor

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.

0 Kudos

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.

0 Kudos

Thanks Rossi,

The issue is resolved.