2013 May 28 4:10 PM
Hi,
I have to write a transformation for XML which contains below part:
<MAIN_NODE>
<NODE_ID type="some_type">2112434324</NODE_ID>
</MAIN_NODE>
destination is a table type with structure:
ZMAIN_NODE:
- TYPE
- CONTENT
so ZMAIN_NODE-TYPE shold equal "some_type" and ZMAIN_NODE-CONTENT should be 2112434324.
Transformation always throws shortdump saying:
Expected was element-end: "NODE_ID" [ ] Read was text: 2112434324 [ ].
I tried so many combinations in simple transformation that it doesn't make sense to paste them here.
Please advise how the transformation should look like.
thanks in advance
2013 May 29 10:27 AM
Solved by myself. Seems that first attribute and node value has to be read to variable.
<tt:ref name=".MAIN_NODE.NODE_ID">
<tt:loop>
<NODE_ID>
<tt:attribute name="type">
<tt:read type="C" var="_TYPE"/>
<tt:assign to-ref="$REF.TYPE" var="_TYPE"/>
</tt:attribute>
<tt:read type="C" var="_CONT"/>
<tt:assign to-ref="$REF.CONTENT" var="_CONT"/>
</NODE_ID>
</tt:loop>
</tt:ref>
2013 May 29 7:37 AM
You could post the transformation source code and ABAP code.
Also post bigger XML sample that clarifies what occurs multiple times, MAIN_NODE or NODE_ID.
It would help pinpoint the issue.
2013 May 29 7:47 AM
Hi,
Please check the below link:
http://scn.sap.com/docs/DOC-35493
Hope it serves useful to you.
Thanks
Akankshi
2013 May 29 7:56 AM
Try it this way.
http://scn.sap.com/thread/1576904
You may also check this link.
https://scn.sap.com/docs/DOC-24791
Thanks,
Susmitha
2013 May 29 10:27 AM
Solved by myself. Seems that first attribute and node value has to be read to variable.
<tt:ref name=".MAIN_NODE.NODE_ID">
<tt:loop>
<NODE_ID>
<tt:attribute name="type">
<tt:read type="C" var="_TYPE"/>
<tt:assign to-ref="$REF.TYPE" var="_TYPE"/>
</tt:attribute>
<tt:read type="C" var="_CONT"/>
<tt:assign to-ref="$REF.CONTENT" var="_CONT"/>
</NODE_ID>
</tt:loop>
</tt:ref>