on 07-10-2008 10:11 AM
Hello experts,
the scenaria is IDOC -> XI -> FTP and content conversion is used.
The structure of the IDOC is like:
<head></head>
<pos>
<subnode></subnode>
</pos>
<pos>
<subnode></subnode>
</pos>
There can be 1 ore more positions.
We mapped this to a XML-structure according to help.sap.com
http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/frameset.htm
As we are not allowed to use subnodes all segments have to be on one level.
How can I map to a structure (with 1 OR MORE positions) like
<head></head>
<pos></pos>
<subnode></subnode>
<pos></pos>
<subnode></subnode>
At the moment we are only able to map to:
<head></head>
<pos></pos>
<pos></pos>
<subnode></subnode>
<subnode></subnode>
In the datatype I can't specify that a position always is followed by a subnode ... i only can use remove context in mapping and put all subnodes beneath the positions. Is there any possibility in graphical mapping to change this?
Thanks and regards,
David
Hi David,
Go thru the below link. This should help you. You can adopt a similar approach -
[Convert Flat File to Deeply Nested XML Structures Using Only Graphical Mapping|http://www.riyaz.net/blog/index.php/2008/05/20/xipi-convert-flat-file-to-deeply-nested-xml-structures-using-only-graphical-mapping/]
Regards,
Riyaz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
Consider taking a reverse approach to the one mentioned in the link above. Use two-step mapping as described.
Create three datatypes, first one nested as per your source message, second one with the same structure but add id attributes to every node as explained in the above link, and the third datatype with a flat structure as you expect to pass on to the file adapter for content conversion.
To populate id attribute values, use globalCounter() UDF given. id attribute is used to preserve the position of a node.
Then by using a Java code similar to the nest() UDF, you can read the queue and convert the nested structure to a flat one. Also try using removeContexts() function. If removeContexts() works, no need to write Java code for UDF.
Let me know if it helps.
Regards,
Riyaz
Ok, what can I do, to describe a data typs with variable amount of pos' FOLLOWED by subnodes?
Or is it possible to create an item line with pos and subnode and remove this line later (move everything to first level).
<item>
<pos>
<subnode>
</item>
<item>
<pos>
<subnode>
</item>
<item>
<pos>
<subnode>
</item>
MAP TO:
<pos>
<subnode>
<pos>
<subnode>
<pos>
<subnode>
I can't create a data type like this...
EDIT:
Remember, there can be documents with 1 or many positions... and the fieldname always is the same.... the datatype definition doesn't acceppt duplicate fieldnames and fields that are not in a defined sequence.
Edited by: David Claes on Jul 10, 2008 2:09 PM
Edited by: David Claes on Jul 10, 2008 2:11 PM
Hi David,
If you are able to populate a structure like -
<item>
<pos>
<subnode>
</item>
<item>
<pos>
<subnode>
</item>
<item>
<pos>
<subnode>
</item>
I guess, you can directly apply file content conversion to it. No need to flatten it further (unless pos and subnode are elements and not nodes). The flat file would have structure of the fields under item node i.e.
pos
subnode
pos
subnode
pos
subnode
Regards,
Riyaz
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.