2018 Jun 29 10:53 PM
Hi
I have to create XML file using ABAP (internal table to xml ). I crate structure and map with transformation tool using tcode XSLT_TOOL . I can download XML file without any issue. but I need to pass value for the root element. I was try to pass different way but its not working. I have to pass " linkey, Action and Type" .those are variable . <Vendor linkey=" " Action=" " type=" ">.
If any one can help me about this it will be grate.
<?xml version="1.0" encoding="UTF-16"?>
-<APVend Companycode="">
-<Vendor linkey=" " Action=" " type=" ">
<idfAPVendorKey>9230000011</idfAPVendorKey>
<idfComment/>
<idfCurrLineUpSeq/>
<idfDatePromisedOffset/>
Hi
I have to create XML file using ABAP (internal table to xml ). I crate structure and map with transformation tool using tcode XSLT_TOOL . I can download XML file without any issue. but I need to pass value for the root element. I was try to pass different way but its not working. I have to pass " linkey, Action and Type" .those are variable . <Vendor linkey=" " Action=" " type=" ">.
If any one can help me about this it will be grate.
<?xml version="1.0" encoding="UTF-16"?>
-<APVend Companycode="">
-<Vendor linkey=" " Action=" " type=" ">
<idfAPVendorKey>9230000011</idfAPVendorKey>
<idfComment/>
<idfCurrLineUpSeq/>
<idfDatePromisedOffset/>
2018 Jul 02 1:10 AM
You can create template in transformation,when call transformation you pass the itab to that template something like this (You can read more about transformation by push F1 on TRANSFORM statement):
In ABAP:
CALL TRANSFORMATION ZXXX
SOURCE source = itab
RESULT xml result.
In Transformation:
<?sap.transform simple?><tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="SOURCE"/>
<tt:template>
<tt:loop name="b" ref=".SOURCE">
<Vendor>
<tt:attribute name="linkey" value-ref="$b.linkey"/>
</Vendor>
</tt:loop>
</tt:template>
2018 Jul 02 2:40 AM
Hi
I found the solution how to create root attribute, you have to create structure and using XSLT_TOOL you can change the Element to attribute .

Regards,
Nawa
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |