cancel
Showing results for 
Search instead for 
Did you mean: 

Subnodes and content conversion in FTP-Adapter

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Thank you, the link is certainly helpfull! However, I use File-Receiver, NOT Sender.

Best regards,

David

Former Member
0 Kudos

Hi David,

What file format you are intending to produce at the target side?

something like below?

pos row

subnode row

subnode row

pos row

subnode row

Regards,

Riyaz

Former Member
0 Kudos

Yes, exactly, this is how the flatfile should look like!

And at the moment it is:

HEAD

POS

POS

SUB

SUB

Best regards,

David

Edited by: David Claes on Jul 10, 2008 11:37 AM

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

I took a Java-Mapping to solve it.

Thanks and regards,

David

Former Member
0 Kudos

Good to know that the issue is resolved.

Cheers,

Riyaz