cancel
Showing results for 
Search instead for 
Did you mean: 

Need Mapping logic for the following scenario

Former Member
0 Kudos

Hi everyone,

I need a mapping logic for the following scenario.

For the same order no with same material no, the quantity should be summed and only one idoc should be created.

For the same order no with different material no, no need to sum the quantity and only one idoc should be created.

For example:

Source Structure:

Ord No Mat No QTY

12 1 2

13 1 3

13 2 1

12 2 4

15 1 5

14 3 7

12 1 6

Target Structure:

Ord No Mat No QTY

12 1 8

12 2 4

13 1 3

13 2 1

14 3 7

15 1 5

Thanks in Advance

Accepted Solutions (1)

Accepted Solutions (1)

sunilchandra007
Active Contributor
0 Kudos

Try the graphical mapping as shown below using concat with a space as delimite and UDF to split the value again by space.

1. Idoc node

(RootContext)
OrdNo
	|concat[ ] -> sort[asending] -> SplitByValue -> collapseContexts -> Idoc
MatNo		      case sensitive    [ValueChange]						
(RootContext)
  

2. OrdNo

OrdNo(RC)
	|concat[ ] -> sort[asending] ->SplitByValue->collapseContexts->SplitByVale-> UDF to fetch ordno  -> OrdNo
MatNo(RC)	      case sensitive    [ValueChange]		      [eachValue]   (return var1.split(" ")[0];)
  

3. MatNo

OrdNo(RC)
	|concat[ ] -> sort[asending] -> SplitByValue ->collapseContexts->SplitByVale-> UDF to fetch ordno  -> MatNo
MatNo(RC)   	      case sensitive    [ValueChange]		        [eachValue]   (return var1.split(" ")[1];)
  

4. Qty

			[asending,case sensitive]			
			--  sortByKey -----> formatByExample -> sum ->Qty
OrdNo(RC)	      |		|		^		 
	|concat[ ] -> |	       Qty(RC)		|
MatNo(RC)	      | 			|	 
			--sort[asending]-> SplitByValue 
		         case sensitive    [ValueChange]
  

Regards,

Sunil Chandra

Answers (2)

Answers (2)

Former Member
0 Kudos

It's working fine. Thank u so much for quick and best resolution.

Former Member
0 Kudos

Hi

You can achieve the same as suggested by sunil .. You might have to "Split By values" after all the steps .. just before mapping the source node to the targer..

Also, I think for the IDOC node.. you might have to change the contexts for the two Source node , Ord No and Mat no..

I have achieved the same functionality .. by following the approach..

Best Regards,

XA