cancel
Showing results for 
Search instead for 
Did you mean: 

How can I map multiple sourcelines of the same position into 1 targetline?

Former Member
0 Kudos

Hi all,

I have a mapping problem in XI. I have no idea how to do the following mapping in the IR. My inputfile contains of 1 headerline and mulitple positions, and it has got multiple lines per position (with different data in it). The targetfile has got 1 headerline and multiple positionslines in which I have to "merge" the data from mulitple source-positionlines. It looks like this:

source structure:

headerdata

position1 part1 (posnr, article number, quantity, articletype,...)

position1 part2 (posnr, article price, payment conditions,...)

position1 part3 (posnr, route,...)

position2 part1

etc

target-structure:

headerdata

position1 (posnr, articlenr, quantity, articletype,price, payment conditions, route)

position2 (same)

position3 (same)

etc

Now I have to map part1,2 and 3 of the source structure to the 1 and the same target-line. I guess I would need some kind of lookup of the positionnumber in my message-mapping. But how do I do this? Copying the targetline 3 times is not an option as the target-utility only accepts the structure as described above....

Hope anybody van help

Thanks,

William

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi JWD,

You can do this mapping with help of value mapping...that is take the unquie fields(Posnr, article number ..etc) and assign the value for article pice...with it.......

So whenever you give the Posnr the value mapping will pick up the respective article price for it .....In this way you can do the mapping....

Kindly follow the very useful link given below...the concept of value mapping is very well explained with screenshots:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00ee347e-aabb-2a10-b298-d15a1ebf...

Regards

Sai

Reward with points if helpful

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

U can do it with UDF but it is more simpler with normal graphical mapping refer the following steps.

1) To map header node for your example (position1) refer the following steps,

posnr --> RemoveContext --> sort --> splitByValue(valueChange) --> CollapseContext --> position1

2) for posnr in target side also u can use same mapping with some change i.e.

posnr --> RemoveContext --> sort --> splitByValue(valueChange) --> CollapseContext > splitByValue(EachValue)>posnr.

3) For other node like articlenr, quantity, articletype,price, payment conditions, route refer the following mapping.

1st do this.

posnr --> RemoveContext --> sort --> splitByValue(valueChange) --> CollapseContext --> splitByValue(EachValue).

then take IfWithOutElse function give 1st input as output of CollapseContext

2nd input is value like articlenr, quantity, articletype,price, payment conditions or route(one of it) --> FormatByExample(using posnr --> RemoveContext --> sort --> splitByValue(valueChange)) node

Output of IfWithOutElse give to splitByValue(EachValue)

Then give it to Target field.

Regards,

Rohit.

reward points if helpful

Former Member
0 Kudos

Hi Rohit,

thanks a lot. I can't get it to work though, I think I misunderstand.... Would it be possible to give me your mailaddress so I can send you a screenshot of my message mapping? Maybe you'll see the problem right away then..

Thanks

William

Former Member
0 Kudos

Hi,

Check my business card.

Regards,

Rohit

Former Member
0 Kudos

But alas, since you need to do lookup and comparison for each incoming value... you have to use UDF. (Just joking)

UDF logic:

Assuming each of part1,part2 and part3 are coming n times each.

Compare part1->posnr, part2->posnr and part3->posnr such as:

UDF1:

for(n times)

{// Compare part1->posnr with all part2->posnr's (n times:for loop)

if Comparison gives false result.addSuppress();

if Comparison gives true

//Compare part2->posnr with all part3->posnr's (n times:for loop)

if Comparison gives false

result.addSuppress();

if Comparison gives true

result.addValue("");

}

UDF2:

It will keep on adding the elements posnr, article number, quantity, articletype,...)posnr, article price, payment conditions,...)(posnr, route,...) indiscriminately. Since we have taken care of when to suppress content and when to addvalue, it will automatically be taken care-of.

Think about it with a an example.

Regards

Reward points for useful answers

Former Member
0 Kudos

In case you want to sort Parts using posnr (In case posnr is coming randomly) you have to write udf's.

However, if their Parts 1,2,3 are coming in sequence your work is cut out.

Former Member
0 Kudos

Hi wiiliam,

you have to modify the context in your targetfield-mappings. Use right mouse to set the context

******************************

forget about this:

you have to use the function

"useOneAnMany"

SAP Network Blog: Replication of Nodes Using the Graphical Mapping Tool

/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool

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

Regards Mario

Edited by: Mario Müller on May 5, 2008 9:17 AM

Edited by: Mario Müller on May 5, 2008 9:22 AM