I am getting XML from from internal tables using Simple Transformation. This is the output XML.
<?xml version="1.0" encoding="UTF-8"?>
<Complement>
<Document Doc="AAA">
<Locations>
<Location>
<Origin
RFC="URE180429TM6"/>
<Address
Country="SOME_COUNTRY"
/>
[....]
</Location>
</Locations>
<Products NumTotal="1">
<Product
ValorProduct="12164501"
/>
[....]
</Product>
</Products>
[....]....
</Document>
</Complement>
But now what I NEED to do is to Change some XML ELEMENT Name (rename them).. which should make my XML looks like this:
For example I need the first Element (Complement) wil looks like cfdi:Complement (using the Colon :
between cfdi and Complement)... etc etc
<cfdi:Complement>
<document:Document Doc="AAA">
<document:Locations>
<document:Location>
<document:Origin
RFC="URE180429TM6"/>
<document:Domicilio
Country="NIGERIA"
/>
[....]
</document:Location>
</document:Locations>
<document:Products NumTotal="1">
<document:Product
ValorProduct="12164501"
/>
[....]
</document:Product>
</document:Products>
[....]....
</document:Document>
</cfdi:Complement>
I have been trying to change the Element Names directly from Simple Transformation Code but it´s not working:
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates"
xmlns:ddic="http://www.sap.com/abapxml/types/dictionary"
xmlns:def="http://www.sap.com/abapxml/types/defined">
<tt:root name="COMPLEMENT" type="ddic:ZCOMPLEMENT"/>
<tt:template>
<tt:namespace name="cfdi"/>
<tt:namespace name="document"/>
<cfdi:Complement> "<----- I get error from this lines
<document:Document> "<----- I get error from this lines
<tt:attribute name="Doc" value-ref=".COMPLEMENT.DOCUMENT.DOC"/>
<document:Locations>
<Location>
<Origin>
<tt:attribute name="RFC" value-ref=".COMPLEMENT.DOCUMENT.LOCATIONS.LOCATION.ORIGIN.RFC"/>
[....]
</Origin>
<Address>
<tt:attribute name="Country" value-ref=".COMPLEMENT.DOCUMENT.LOCATIONS.LOCATION.ADDRESS.COUNTRY"/>
[....]
</Address>
</Location>
</Locations>
<Products>
<tt:attribute name="NumTotal" value-ref=".COMPLEMENT.DOCUMENT.PRODUCTS.NUMTOTAL"/>
<Product>
<tt:attribute name="ValorProduct" value-ref="VALORPRODUCT"/>
[....]
</Product>
</Products>
[....]....
</Document>
</Complement>
</tt:template>
</tt:transform>
these are the errors i get:
undeclared namespace prefix 'cfdi'
and
undeclared namespace prefix 'document'
This is the Simple Transformation Code:
I just need to change the name of Element. But I didn´t think it is harder than it seems.
Kindly help me on this. I´m new in this Abap World. or any idea will help me so so much. Regards