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: 

XSLT Transformation from XML to ABAP field

Former Member
0 Kudos

Hi all,

How can I retrieve my XML node's value (EMPLOYEE) XML to an ABAP variable (W_KUNNR)


  DATA w_kunnr TYPE string.

  CONCATENATE
    '<services>'
    '<Myservice>'
    '<APPLICATION>APPLI1</APPLICATION>'
    '<SERVICE>SERV1</SERVICE>'
    '<TOSAP>'
    '<EMPLOYEE>00000036</EMPLOYEE>'
    '</TOSAP>'
    '</Myservice>'
    '</services>'
  INTO request.

  CALL TRANSFORMATION z_trans
  SOURCE XML request
  RESULT kunnr = w_kunnr.

thanks.

Edited by: Noureddine MOUTAA on Oct 28, 2008 2:25 PM

1 REPLY 1

Former Member
0 Kudos

I did like this:


<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
  <xsl:strip-space elements="*"/>

  <xsl:template match="/">
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
      <asx:values>
        <KUNNR>
          <xsl:value-of select="//services/Myservice/TOSAP/EMPLOYEE"/>
        </KUNNR>
      </asx:values>
    </asx:abap>
  </xsl:template>
</xsl:transform>