Page 1 of 1

XML Header and Detail record

Posted: Fri Mar 06, 2009 11:38 pm
by ajmore
Hi,

For the following xml as source file, i need to import data in dataset.

<IDOC>
- <ZCOMMHDR>
<ZCOMPANY>8206</ZCOMPANY>
</ZCOMMHDR>
- <ZCOMMDET>
<ZARTICLE>T816028NY00100</ZARTICLE>
</ZCOMMDET>
- <ZCOMMHDR>
<ZCOMPANY>8293</ZCOMPANY>
</ZCOMMHDR>
- <ZCOMMDET>
<ZARTICLE>T816028NY0E0200</ZARTICLE>
</ZCOMMDET>
- <ZCOMMDET>
<ZARTICLE>T313193VE0233</ZARTICLE>
</ZCOMMDET>
</IDOC>


Data should come the following format

<ZCOMPANY>;<ZARTICLE>

1st record : 8206;T816028NY00100
2nd record : 8293;T816028NY0E0200
3rd record : 8293;T313193VE0233

When i marked <ZARTICLE> {lowest element} as key field, i get 3 records as output, but as seen below it is not the required output.

1st record : 8206;T816028NY00100
2nd record : 8206;T816028NY0E0200
3rd reocrd : 8206;T313193VE0233

Can anyone please let me know any workaround for this issue?

Posted: Sat Mar 07, 2009 7:47 am
by chulett
Post your XPath Expressions.

Posted: Sat Mar 07, 2009 5:54 pm
by eostic
The retrieval that you see is correct. Article, as a part of ZCOMMDET is an entirely separate repeating group from anything in ZCOMMHDR. They may "look" like a parent child relationship, but they are not.... to get the results you are looking for, ZCOMMHDR would have to be entirely wrapping the ZCOMMDET element. In this document they are equal. Without resorting to changes in xpath, you could just have two links, and then a counter to match them up later.

Ernie