Skip to Content
0
Former Member
Apr 21, 2010 at 02:42 PM

Simple Transformation : Input parameter and how?

140 Views

Hi

I am currently trying to import XML data from a REST call using the CALL TRANSFORMATION technique.

I have no XML experience and I am having a hard time understanding how to code my transformation object. What it is suppose to do is just return the returnCode value from the XML. This can be either 0 or 1.

Here is what I have come up with so far.

-


Original XML input

______________________________

<?xml version="1.0" encoding="UTF-8"?>

<serviceResponse>

<serviceCode>200</serviceCode>

<serviceCodeName>OK</serviceCodeName>

<serviceCodeDescription>The request succeeded normally.</serviceCodeDescription>

</serviceResponse>

<queryResponse>

<returnCode>0</returnCode>

<message>Document was found.</message>

</queryResponse>

<results>

<document>

<link rel="alternate" href="######################################"/>

<id>urn:uuid:7950d427-611b-4de2-8146-ecb82f67bf8a</id>

<updated>2010-04-15T11:34:28.115+02:00</updated>

<creator>

<name>admin</name>

</creator>

</document>

</results>

-


Transformation object source code

_______________________________

<?sap.transform simple?>

<tt:root name ="SERVICERESPONSE"/>

<tt:root name ="QUERYRESPONSE"/>

<tt:template>

<queryResponse tt:ref="QUERYRESPONSE">

<returnCode>

<tt:value value-ref="R_CODE"/>

</returnCode>

</queryResponse>

</tt:template>

</tt:transform>

-


Transformation call

_______________________________

CALL TRANSFORMATION ZTRANS_ALF

SOURCE XML p_content

RESULT R_CODE = l_response.

-


All I wish to achieve is to take the result obtained from my rest call (which is the original XML), look for the returnCode value under the queryResponse root and return it to my ABAP program.

Any help would be greatly appreciated.

Best regards.

A.D.Oosthuizen