I solved my problem, here my code:
<?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="ROOT" type="?"/> <tt:root name="CANCELACION" type="ddic:ZSDWA_CANCELACION_FOLIO"/> <tt:template> <CANCELACION> <tt:attribute name="Rfcemisor" value-ref=".CANCELACION.RFCEMISOR"/> <tt:attribute name="Fecha" value-ref=".CANCELACION.FECHA"/> <Folios> <UUID tt:value-ref=".CANCELACION.FOLIOS.UUID"/> <rfcreceptor tt:value-ref=".CANCELACION.FOLIOS.RFCRECEPTOR"/> <total tt:value-ref=".CANCELACION.FOLIOS.TOTAL"/> </Folios> </CANCELACION> </tt:template> </tt:transform>
Hello Sandra, Thanks for you respnse,
I did a transformation, and I get my XML in this format:
but I need my xml in the format like follow:
Can you please help me? My xml code its follow:
<?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="ROOT" type="?"/> <tt:root name="CANCELACION" type="ddic:ZSDTT_XML_CANCELACION"/> <tt:template> <Cancelacion> <tt:loop ref=".CANCELACION"> <Cancelacion> <tt:attribute name="Fecha" value-ref="FECHA"/> <tt:attribute name="Rfcemisor" value-ref="RFCEMISOR"/> <Folios> <UUID tt:value-ref="FOLIOS.UUID"/> <rfcreceptor tt:value-ref="FOLIOS.RFCRECEPTOR"/> <total tt:value-ref="FOLIOS.TOTAL"/> </Folios> </Cancelacion> </tt:loop> </Cancelacion> </tt:template> </tt:transform>
Hi Sandra,
Sorry for images, I dont know why I have 2 <Cancelacion> Elements, is there any way to have only one like my reques?
I am looking for examples like I need but all examples does not have an XML structure like I need, its not possible to do a transformation as I need?
My transformation:
<?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="CANCELACION" type="ddic:ZSDTT_XML_CANCELACION"/> <tt:template> <Cancelacion> <tt:loop ref=".CANCELACION"> <Cancelacion> <tt:attribute name="Fecha" value-ref="FECHA"/> <tt:attribute name="Rfcemisor" value-ref="RFCEMISOR"/> <Folios> <UUID tt:value-ref="FOLIOS.UUID"/> <rfcreceptor tt:value-ref="FOLIOS.RFCRECEPTOR"/> <total tt:value-ref="FOLIOS.TOTAL"/> </Folios> </Cancelacion> </tt:loop> </Cancelacion> </tt:template> </tt:transform>
I need an XML like follow
<?xml version="1.0" encoding="ISO-8859-1"?> <Cancelacion RfcEmisor="AAA010101AAA" Fecha="2019-01-28T18:18:30"><Folios> <UUID>e9a646bb-f131-4d4e-aa0e-d0cc80e927a6</UUID> <rfcreceptor>XEXX010101000</rfcreceptor> <total>0</total> </Folios> </Cancelacion>
Thaks
Create the Simple Transformation ZST (transaction STRANS):
<?sap.transform simple?> <tt:transform xmlns:tt="http://www.sap.com/transformation-templates" xmlns:ss="cc"> <tt:root name="RFCROOT"/> <tt:root name="UUIDROOT"/> <tt:template> <Cancelacion> <tt:attribute name="RfcEmisor" value-ref=".RFCROOT"/> <Folios> <UUID tt:value-ref=".UUIDROOT"/> </Folios> </Cancelacion> </tt:template> </tt:transform>
(I let you do the missing parts)
Create this ABAP code:
DATA: uuid type string value 'e9e646b.....', rfc type string value 'XEXX01010100', xml TYPE xstring. CALL TRANSFORMATION zst SOURCE rfcroot = rfc uuidroot = uuid RESULT XML xml.
The encoding is then UTF-8 on Unicode systems (7.5* are Unicode now), but the receiver system should interpret both encodings correctly.
PS: but why people paste image instead of text, should the people answering have to spend time to convert it to text ?
Add comment