Well, that changes the situation:-). Bellow is an Xquery that I think that it does what you need. Have a look and let me know
declare @xml xml =
'<?xml version="1.0" encoding="iso-8859-2"?>
<ZINVOIC3>
<IDOC BEGIN="1">
<E1EDK02 SEGMENT="1">
<QUALF>009</QUALF>
<BELNR>1012833285</BELNR> <!-- InvoiceNumber -->
</E1EDK02>
<E1EDK02 SEGMENT="1">
<QUALF>001</QUALF>
<BELNR>NO01140804</BELNR> <!-- OrderNumber -->
</E1EDK02>
<E1EDP01 SEGMENT="1">
<MENGE>1.000</MENGE> <!-- Quantity -->
<E1EDP19 SEGMENT="1">
<QUALF>002</QUALF>
<IDTNR>80008932</IDTNR> <!-- IdWare -->
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>003</QUALF>
<IDTNR>8590669055883</IDTNR> <!-- EanWare -->
</E1EDP19>
</E1EDP01>
<E1EDP01 SEGMENT="1">
<MENGE>2.000</MENGE>
<E1EDP19 SEGMENT="1">
<QUALF>002</QUALF>
<IDTNR>40008932</IDTNR> <!-- IdWare -->
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>003</QUALF>
<IDTNR>8590669055890</IDTNR> <!-- EanWare-->
</E1EDP19>
</E1EDP01>
</IDOC>
</ZINVOIC3>'
--select @xml
select --tbl.x.query('.'),
tbl.x.value('(../E1EDK02[QUALF="009"]/BELNR)[1]','varchar(20)') as InvoiceNumber,
tbl.x.value('(../E1EDK02[QUALF="001"]/BELNR)[1]','varchar(20)') as OrderNumber,
tbl.x.value('(MENGE)[1]', 'real') as Quantity,
tbl.x.value('(E1EDP19[QUALF="002"]/IDTNR)[1]', 'int') as IdWare,
tbl.x.value('(E1EDP19[QUALF="003"]/IDTNR)[1]', 'bigint') as EanWare
from @xml.nodes('ZINVOIC3/IDOC/E1EDP01') tbl (x)
Adi
--------------------------------------------------------------
To know how to ask questions and increase the chances of getting asnwers:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/