on 01-11-2018 2:25 PM
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?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="ROOT" />
<tt:template>
<Root xmlns:xsi="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>
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 ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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).
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.