2013 Sep 11 12:08 PM
All,
I have to convert a deep structure into an XML document. The deep structure contains repeating elements inside the top element.
I created table types with linetypes as the structure whcih inturn have table types. When i use the main strucutre in STRANS to generate the transformation, an additional element is cretaed for everylinetype i specified for the tabletype which I donot want.
For ex.
ZTAB IS TABLE TYPE WITH LINE TYPE as ZLINETYPE.
Desired output.
<PAGE>
<FIELDA></FIELDA>
<FIELDB></FIELDB>
<ZTAB>
<FIELD1> </FIELD1>
<FIELD2> </FIELD2>
</ZTAB>
<ZTAB>
<FIELD1> </FIELD1>
<FIELD2> </FIELD2>
</ZTAB>
</PAGE>
But in the STRANS while creating the transformation, I get
<PAGE>
<FIELDA></FIELDA>
<FIELDB></FIELDB>
<ZTAB>
<ZLINETYPE>
<FIELD1> </FIELD1>
<FIELD2> </FIELD2>
</ZLINETYPE>
</ZTAB>
<ZTAB>
<ZLINETYPE>
<FIELD1> </FIELD1>
<FIELD2> </FIELD2>
</ZLINETYPE>
</ZTAB>
</PAGE>
How do i avoide this additional element of linetypes ?
Am I missgin anything here ? Any pointers will be very helpful.
Thanks
BR
NIlesh Puranik
2013 Sep 11 12:31 PM
2013 Sep 11 12:31 PM
2013 Sep 11 1:11 PM
HI Manish,
There is no ABAP code as I didnt call the transformation yet. I created the table types and line types in the ABAP data dictionary in SE11 and used it in the STRANS.
In the STRANS i see following
If you see LEVERINGADRES is a table of linetype ZLEV_ADRES which has fields like STRAAT and so on but i don't want ZLEV_ADRES to appear as an element in the XML file to be generated.
Same goes to element ZCMETER as well.
Any idea about this or may be my XML hierarchy is logically not correct ?
Thanks in advance.
BR
Nilesh
2013 Sep 11 1:33 PM
So it is a simple transformation.
I opened DEMO_ST_TABLE in STRANS and saw something similar.
Output would have table tag, and n number of tr tags.
It is possible to drag every node under tr tag on tr tag so that they come directly under table icon, and then tr tag can be deleted. Looking at below screenshot, it won't have n number of tr tags because everything under it has been moved one level up, directly under table icon.
You can try something similar.
2013 Sep 17 12:37 PM
Hello Manish,
Exactly what i was looking for. Thanks a lot for sharing the trick !
-Nilesh
2013 Sep 11 1:27 PM
Hi Nilesh,
You can modify the tag names as per your requirement.
There are lot of blogs if you search...
©: Generate Simple Transformation for XML in ABAP - Part II:Careerless Whispers about SAP
Also run the transformation to see the output then make amendments accordingly.
Regards
2013 Sep 11 1:31 PM
Hello Mohammed,
Thanks for the answer but I dont wish to modify the tag names but I want that element NOT to be present in the XML file. This element is coming of the linetype i specify in the table type while creating the structure.
Thanks
BR
Nilesh