Application Development and Automation 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: 
Read only

Simple Transformation : Input parameter and how?

Former Member
0 Likes
518

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>

<title>90860348.pdf</title>

<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

1 REPLY 1
Read only

Former Member
0 Likes
378

To Clarify the question: How do I code my Source Code for my ST Object to take the returnCode value and pass it to the calling ABAP program.