cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI - One Source Field many Target fields

vossk2
Explorer
0 Kudos

Hello experts,

I have created a mapping-scenario where the source fields is once per context filled with data and I want that data in a target field in ten Idocs.

You can see an example in the pictures I added below.

Thanks in advance,

David

queue-problem.pngidoc-problme.png

Accepted Solutions (0)

Answers (2)

Answers (2)

JaySchwendemann
Active Contributor

The screenshots do not help very much (at least to me) but I would assume

  • input data looks like this
<recordset>
	<record>
		<data1>a1</data1>
		<data2>a2</data2>
		<data3>a3</data3>
		<!-- more data -->
	</record>
	<record>
		<data1>b1</data1>
		<data2>b2</data2>
		<data3>b3</data3>
		<!-- more data -->
	</record>
	<!-- more records -->
</recordset
  • You have some data that is an identifier to the record set or at least some data that is always there in the record, whereas other data might be there or might be not. Let's call this special data "key" shall we?
  • You want to create a multi mapping resulting in an "COND_A02" IDoc (I don't even know what that is for 🙂 ) per record?

If that's the case I think you wouldn't even need useOneAsMany which Praveen suggested. You could simply map the record to the "multi-root-node" (the one below message node) of multi mapping and then work your way down using one-to-one mapping and using map with default where appropriate. If it is a really deeply nested IDoc you surely must look into useOneAsMany, look at contextes or other "node functions".

Cheers

Jens

vossk2
Explorer
0 Kudos

Hi Jens,
you're right on target with your hunch about the source structure.
The problem is that no source field always contains the same data but different data.
Yes, that is correct again. I want to create a multi-mapping by creating 10 IDocs. The special thing about this is that ten target IDocs are created from seven fields in the source structure. Roughly speaking, each source field creates a target IDoc with many fixed values.
But thank you for your effort.

JaySchwendemann
Active Contributor
0 Kudos

okay, I get that the real life is more complicated that my example 🙂

Anyways, I'm still not sure where exactly you are stuck. What hinders you to map the <record> node with your <COND_A02> node which by using a multi mapping (message mapping --> signature --> target message --> occurence 0...unbounded) will become 0...unbounded. (Subtext, you don't use "duplicate subtree" then). If you only conditionally need to create an IDoc, say when input recordset has so and so field values, than do so .e.g using createIf.

Also, depending on the complexity of your mapping logic, you might be better of using XSLT, instead of graphical mapping. However, I've never done that with multi mapping, but I'm quite positive it should be possible. Have a look here for example: https://answers.sap.com/answers/13095183/view.html

Cheers

Jens

vossk2
Explorer
0 Kudos

Hi, Jens,
I have not solved the mapping in this way because different fixed values are to be written to the fields in each IDoc.
Thank you for linking the instructions for XSLT mapping.

PS: After searching for the error in the mapping all morning, it turned out that the source data was incorrect...

But thanks for your help anyway.

Best Regards,

David

0 Kudos

Hi David Faßhauer,

Could you please try Node function use-one-asMany.

https://help.sap.com/viewer/0b9668e854374d8fa3fc8ec327ff3693/7.3.19/en-US/4bf416edeaca4c86e10000000a...

Hope this helps !

thanks and regards,

Praveen T

vossk2
Explorer
0 Kudos

Hi Praveen Tirumareddy,

thanks for your help.

I tried the Useoneasmany function, but I can't get the number of times I want to multiply the value from the source structure. Because this structure appears infinitely often and not only ten times as I need it.

You can see more information in the pictures I have attached.pi-problem.png

Thanks and regards,
David F