07-03-2013 2:16 PM
Hi there i have read now a lot of things about ST but still i don't grasp certain concept.
I have tho following (simplified) XML and Datastructure:
TYPES: BEGIN OF test,
clsname TYPE string,
source TYPE stringtab,
END OF test.
DATA tab TYPE zst_t_test..
DATA str TYPE string.
str =
'<classes>' &&
'<class name="zcl_umap_exception_object" isException="false">' &&
'<definition>' &&
'abc' &&
'</definition>' &&
'<publicSection>' &&
'class zcl_umap_exception_object definition INHERITING FROM ZCL_UMAP_CLASS_OBJECT.' &&
'</publicSection>' &&
'<privateSection>' &&
'private section.' &&
'</privateSection>' &&
'</class>' &&
'</classes>'.
and what i want to achieve is that everything is put into table source. but somehow that doesn't work. i am using this 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="ROOT" type="ddic:ZST_T_TEST"/>
<tt:template>
<classes>
<tt:loop ref=".ROOT">
<class>
<tt:attribute name="name" value-ref="CLSNAME"/>
<definition>
<tt:value ref="$ref.SOURCE"/>
</definition>
<tt:loop name="b" ref="SOURCE">
<publicSection>
<tt:value ref="$b"/>
</publicSection>
</tt:loop>
<tt:loop name="b" ref="SOURCE">
<privateSection>
<tt:value ref="$b"/>
</privateSection>
</tt:loop>
</class>
</tt:loop>
</classes>
</tt:template>
</tt:transform>
first thing that really irritates me is that the syntax check says "type ... is not atomic" for the <definitions> tag. so how to read that specific value?
Next even when i put a loop around <definition> the loop of the <publicSection> is overwriting all previous entries, same for the loop of <privtaeSection>
And worse in my real XML <publicSection itself can contain lots of attributes and other stuff which i have to loop over as well.
so the Questions is: How can i append everything to just on table?
Regards
07-04-2013 2:04 PM
Ok problem solved, anyone stumbling about the same issue, use assign and read..