Skip to Content
-1

Outbound XML Transformation error in SAP

Jan 11 at 02:25 PM

132

avatar image
Former Member

Hello, I am trying to generate XML. I wrote the following transformation but it is resulting error when referring the XML transformation.

'Error during access to the ref node 'ROOT'. The ref node is not defined or does not have the necessary type'

Transformation as below.

<?sap.transform simple?>
http://www.sap.com/transformation-templates">
<tt:root name="ROOT" />
<tt:template>
http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Part_by_Supplier.xsd">
<PartConversion>
<tt:loop name="line" ref=".ROOT">
<CompanyNumber>
<tt:value ref="$line.COMPANYNUMBER"/>
</CompanyNumber>
<Active>
<tt:value ref="$line.ACTIVE" />
</Active>
<CompanyPartNumber>
<tt:value ref="$line.COMPANYPARTNUMBER" />
</CompanyPartNumber>
<SupplierNumber>
<tt:value ref="$line.SUPPLIERNUMBER" />
</SupplierNumber>
<UnitMesaurePart>
<Name tt:value-ref="$line.UNITMESAUREPART.NAME"/>
<Isocode tt:value-ref="$line.UNITMESAUREPART.ISOCODE"/>
</UnitMesaurePart>
<UnitMeasureConversion>
<Name tt:value-ref="$line.UNITMEASURECONVERSION.NAME"/>
<Isocode tt:value-ref="$line.UNITMEASURECONVERSION.ISOCODE"/>
</UnitMeasureConversion>
<ConversionFactor tt:value-ref="$line.CONVERSIONFACTOR"/>
</tt:loop>
</PartConversion>
</Root>
</tt:template>
</tt:transform>

 Can someone please help. Thank you very much.
10 |10000 characters needed characters left characters exceeded
You forgot to post the relevant ABAP code! (call transformation and data type)
0
* Please Login or Register to Answer, Follow or Comment.

6 Answers

Horst Keller
Jan 11 at 03:19 PM
3

Well, for basic questions like this, I wrote a documentation and provide lots of examples in the documentation that don't have errors.

https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenabap_st.htm

Check those ...

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Very Helpful documentation

0
avatar image
Former Member Jan 28 at 11:56 PM
-1

There are 2 issues. In call transformation, ROOT_NAME is replaced with Transformation root name. It resolved the issue.

In sending issue, Webservice URL is incorrect. That's corrected in SOAManager and it worked. now. But only problem was we had BOM indicator in XML file and with UTF-16 encoding. That anyway is okay for us. BOM indicator is resolved with disabling <?xml...> completely. Thank you all for your help.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 28 at 11:57 PM
-1

There are 2 issues. In call transformation, ROOT_NAME is replaced with Transformation root name. It resolved the issue.

In sending issue, Webservice URL is incorrect. That's corrected in SOAManager and it worked. now. But only problem was we had BOM indicator in XML file and with UTF-16 encoding. That anyway is okay for us. BOM indicator is resolved with disabling <?xml...> completely. Thank you all for your help.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 12 at 07:27 PM
-2

CALL TRANSFORMATION ... SOURCE ROOT = structured_variable

For my transformations, in CALL TRANSFORMATION xxxxx SOURCE (root name) = data_table RESULT XML xstring.

I just changed the root name same as my root name in transformation and xstring with type string. It started working.

If someone tells me the differences for this, it will be helpful.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Obviously, your root names must match. I guess you don't need an explanation for that.

We can't answer for the type string versus xstring, because you didn't post your ABAP code. The only difference within CALL TRANSFORMATION is that an XSTRING means UTF-8 encoding, while a STRING is not converted (by definition, a STRING has the same encoding as the one of your system, some UTF-16/UCS-2, with variation on the endianness).

0
avatar image
Former Member Jan 11 at 03:00 PM
0

Hello,

I believe the syntax is not correct. It should be like below:

<tt:root name="ROOT" type="?"/>

<tt:root name="DOCUMENTS" type="ddic:ZADV_CORRESPONDENCE"/>

Please change and let us know if it's helpful.

Regards,

Rohit Tiwari

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

<?sap.transform simple?>
http://www.sap.com/transformation-templates">
<tt:root name="ROOT" type="?"/>
<tt:root name="PARTCONVERSIN" type="ddic:ZML_S_PARTCONVERSION1"/>

It now says, 'undeclared namespace prefix 'ddic'
0

Of course, see my answer to learn why.

(and also learn the basics of XML, especially about the usage of namespaces)

https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenxml_oview.htm

0
Sandra Rossi Jan 12 at 10:13 AM
0

I see in your comment that you refer to ZML_S_PARTCONVERSION1, does the S mean that it's a structure, and that you use CALL TRANSFORMATION ... SOURCE ROOT = structured_variable... If that's right, then it means that you should replace structured_variable with an internal table (because you use tt:loop in your transformation). If your variable is a table ITAB with the obsolete header line, then remember to write ITAB[] (with square brackets) to refer to the body of the table, not the header line.

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member
Very Helpful
0
Former Member

There are 2 issues. In call transformation, ROOT_NAME is replaced with Transformation root name. It resolved the issue.

In sending issue, Webservice URL is incorrect. That's corrected in SOAManager and it worked. now. But only problem was we had BOM indicator in XML file and with UTF-16 encoding. That anyway is okay for us. BOM indicator is resolved with disabling <?xml...> completely. Thank you all for your help.

0

As explained in the ABAP documentation, the BOM is generated when you store the transformation result into a STRING variable. If you store it into an XSTRING variable, there's no BOM and the encoding is UTF-8.

PS: in the forum, you have the action "delete" to delete your extra replies.

0