cancel
Showing results for 
Search instead for 
Did you mean: 

useOneAsMany problem.

Former Member
0 Kudos

Hi, experts!

I need to map this structure:

 
<InvoiceXml>
	<Envelope>
		<Sender>231141</Sender>
		<Receiver>7290058160372</Receiver>
		<DocType>INV100</DocType>
		<Header>
			<InvoiceNo>111</InvoiceNo>
			<InvoiceMonth>200809</InvoiceMonth>
			<SupplierCode>231141</SupplierCode>
		</Header>
                                <Header>
			<InvoiceNo>222</InvoiceNo>
			<InvoiceMonth>200809</InvoiceMonth>
			<SupplierCode>231141</SupplierCode>
		</Header>
	</Envelope>
</InvoiceXml>

to structure:

 
<InvoiceXml>
	<Envelope>
		<Sender>231141</Sender>
		<Receiver>7290058160372</Receiver>
		<DocType>INV100</DocType>
		<InvoiceNo>111</InvoiceNo>
		<InvoiceMonth>200809</InvoiceMonth>
		<SupplierCode>231141</SupplierCode>
	</Envelope>
                <Envelope>
                            <Sender>231141</Sender>
		<Receiver>7290058160372</Receiver>
		<DocType>INV100</DocType>
		<InvoiceNo>222</InvoiceNo>
		<InvoiceMonth>200809</InvoiceMonth>
		<SupplierCode>231141</SupplierCode>
	</Envelope>
</InvoiceXml>

I'am using "useOneAsMany" function, this way:

........................... _________________

Envelope----


| ...........................|

Sender -


| useOneAsMany. |----


Sender

Envelope----


|________________|

but it didn't work What's wrong?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I need to map nodes from Envelope(that occurs only once) to each Envelope on the other side. So the I think, the only way is to use useOneAsMany?

Former Member
0 Kudos

Hi,

> So the I think, the only way is to use useOneAsMany?

Yes I guess now you are right.

But as third parameter you should use these parameters:

Sender

Header

Header

and I still guess that you should use the splitByValue function after useOneAsMany.

Regards

Patrick

Edited by: Patrick Koehnen on Dec 2, 2008 3:04 PM

Former Member
0 Kudos

Hi Patrick,

I've tried that. It's don't transfer node values

........................... _________________

Envelope----


| ...........................|...........___________

Sender -


| useOneAsMany. |--


|SplitByValue|--


Sender

Sender----


|________________|

Edited by: Dani_K on Dec 2, 2008 3:09 PM

Former Member
0 Kudos

Hi,

sorry I changed my answer a little bit

But I tested it and it should work now.

Regards

Patrick

BTW without the splitByValue function I get exactly your error message:

> Cannot produce target element /ns0:ProxyStructMT/Envelope/Sender. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd

Former Member
0 Kudos

Thanks Patrick!

It's OK now!

Former Member
0 Kudos

Hi,

it's good that it works now!

Just to make it complete:

If one of the fields

<InvoiceNo>

<InvoiceMonth>

<SupplierCode>

is an obligatory field and you use it as third parameter of the useOneAsMany function with context Header then the splitByValue function is not needed anymore.

Regards

Patrick

Former Member
0 Kudos

Thanks, Patrick!

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Dani ,

Try this

Sender -


>

CopyPerValue -


> SplitByValue -


> Sender

Header----


>

First map sender and Header source nodes to standard function copypervalue and then use splitbyvalue and then map it to target field sender

and try the same for other source nodes

like Reveiver and DocType

Regards

Syed

Edited by: Umar Syed on Dec 2, 2008 2:50 PM

Edited by: Umar Syed on Dec 2, 2008 2:51 PM

Former Member
0 Kudos

Hi, Umar Syed.

I've got error:

Cannot produce target element /ns0:ProxyStructMT/Envelope/Sender. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd

Former Member
0 Kudos

Hi,

at the moment I don't understand why you need useOneAsMany in this case, but if it's really needed try it with splitByValue like mentioned here:

http://help.sap.com/saphelp_nw04/helpdata/en/ef/df564b6aa24fc9ab0d685460747de5/frameset.htm

Regards

Patrick

SudhirT
Active Contributor
0 Kudos

Hi Dani,

Check in display queue for all the source fields it should have same no. of contexts. In your case it is not so, thats why you are getting this error.

What is your requirement?

Thanks!

Former Member
0 Kudos

Hi Dani,

Map like this...

Header(Source)----


Envelope(Target)

InvoiceNo(Source)--SplitByValue(EachValue)--InvoiceNo(Target)

Regards,

RajeshKumar.D

Former Member
0 Kudos

Hi Rajesh,

the problem is in nodes that were in Envelope(not in Header)

such as Sender, Receiver and so...

Those nodes I faild to map.