cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Strans XSLT-Programm Conversion error

mt13065
Explorer
0 Likes
1,879

I often use strans for XML->ABAP TABLE conversion, but I have encountered the following problem. The correct result should be that there is only one row of data in the ''GT_ORDER-PART'' of each row, but now he has two rows, he has read all the The data in "part", how can I make him correspond to ORDER?

View Entire Topic
Sandra_Rossi
Active Contributor
0 Likes

XSLT refers to nodes by using the XPATH language, which use absolute (start with / like in your example /OrdersOrder) or paths relative to the "context node" (not starting with /, like Parts/Part as I show below). The context node is changed by XSLT at runtime, for example for-each sets the context node to the currently-iterated node.

I think that should work:

            <xsl:for-each select="/Orders/Order">
                ...
                    <xsl:for-each select="Parts/Part">

Note: $var1/Parts/Part is equivalent to /Orders/Order/Parts/Part which starts from the root and parses all nodes matching that path.

mt13065
Explorer

oh my god,i'm so stupid,I tried /Parts/Part, but I didn't try what you said,thank you so much.

Sandra_Rossi
Active Contributor

By the way, you should better switch to the Simple Transformation language (provided that the transformations remain simple), because it's something like 10 times faster.

mt13065
Explorer
0 Likes

i will, but simple need create all fields in se11 ,If I am not mistaken.
but I am worried that the customer will add the fields that need to be read later. I am preparing to create a simple strans,thank you again.^_^

Sandra_Rossi
Active Contributor
0 Likes

A Simple Transformation may work without any reference to the DDIC i.e. the type of the data root is optional, in that case it's considered of type "any" and it will check the ABAP names when the transformation runs.