cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping question

Former Member
0 Kudos

Hi,

Can anyone help me with the following mapping issue?

I am only giving the segments concerning the issue.

Input

<E1EDP01>

<E1EDP19>

<QUALF> 002 </QUALF>

<IDTNR> 111 </IDTNR>

</E1EDP19>

<E1EDP19>

<QUALF> 001</QUALF>

<KTEXT> XXX </KTEXT>

</E1EDP19>

</E1EDP01>

<E1EDP01>

<E1EDP19>

<QUALF> 002 </QUALF>

<IDTNR> 222 </IDTNR>

</E1EDP19>

<E1EDP19>

<QUALF> 001</QUALF>

<KTEXT> YYY </KTEXT>

</E1EDP19>

</E1EDP01>

Output

<ItemDetail 0..unbounded>

<PartNumbers 0...1>

<SellerPartNumber 0...1>

<Part ID 1..1/>

</sellerPartNumber>

</PartNumbers

<ItemDescription 0..1/>

</ItemDetail>

This is the mapping I did.

E1EDP01 ==> ItemDetial

If QUALF=002[Context=E1EDP01] then E1EDP19[Context=E1EDP01]=SellerPartNumber

If QUALF=002[Context=E1EDP01] then IDTNR[Context=E1EDP01] = PartID

If QUALF=001[Context=E1EDP01] then KTEXT[Context=E1EDP01] = ItemDescription

But the problem is it is missing some occurances.I have 3 items in my input, but I am getting only two in the output.The second occurance is completely missed and the third shows as the second. I tried different techniques like changing the contexts in different combinations.The solution may be fairly simple,but obviously I miss something here.

Any help is appreciated.

Thanks

Raju

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi raju

Its obvious that you will get two items only.

as your E1EDP01 occurs twice.

For every ocurence it will map its first item to the output side.

I would say go for user defined funtion which will check how many items are there and output of user defined function will contol of item detail.

I hope you will get all three items right now.

Regards

Piyush

Former Member
0 Kudos

Thank you for your responses.

Stefan, I tried your suggestion, didn't work.

Piyush,I am afraid you didn't get my point, I am using the higher context for QUALF,so that I will get both 002 and 001 QUALF per one E1EDP01. But I appreciate your suggestion to use user defined function and will try it.

Thank you

Raju

stefan_grube
Active Contributor
0 Kudos

Hi Raju,

now I have updated my proposal.

The problem is easier as it looks first. But you have to be sure, that in each E1EDP01 segment there is just one IDTNR and one KTEXT.

But always remember:

When you have a 1:1 occurancy, you should never apply conditions to it. This leads to errors.

It is sufficiant, that there is a condition on the parent node.

Regards

Stefan

Former Member
0 Kudos

Stefan,

That is exactly what I did. Strange as it may look, it didn't work.Remember, I can't map "constant" to Seller Part Number but only when QUALF=002.

it is Buyer Part number if it's QUALF=001.

So, only if it's 002 I need to create Seller Part Number, that is why I did

If QUALF=002 then E1EDP19=Seller PartNumber and then IDTNR=PartID...and so on.

You are right, I can't place conditions for 1..1, but that is least of my problems now and it was not cribbing because I was always getting a 002.I corrected that.

What I suspect is there is no higher node for Description to map E1EDP19 as I did for Seller Partnumber(which is the higer node for PartID), so I am not able to bring it to the next context of E1EDP19....but I may be wrong.(Seller Part number and description are at the same level)

Appreciate your response.

stefan_grube
Active Contributor
0 Kudos

My mapping proposal worked for the data you provided. If your source is different, you should provide it for me.

Maybe that helps:

QUALF=002[Context=E1EDP01] createIf -> SellerPartNumber

IDTNR[Context=E1EDP<b>19</b>] -> PartID

If QUALF=001[Context=E1EDP01] then KTEXT[Context=E1EDP01] = ItemDescription

That worked for me as well.

Regards

Stefan

Former Member
0 Kudos

Pls check this map & see if it helps...

E1EDp01 -- ItemDetail

E1EDp01-- splitbyvalue -- Partnumbers

qualf(P01) =002

\

if -- splitbyvalue -- sellerpartnumber

/

qualf(P01)

qualf(P01) =002

\

if -- splitbyvalue -- Part ID

/

IDTNR(P01)

qualf(P01) =001

\

if -- splitbyvalue -- Item Description

/

KTEXT(P01)

Thanks,

Renjith

Former Member
0 Kudos

Renjith,

This solution worked.Thank you very much for each of you for the responses.

I awarded points to Renjith.

Raju Jampana

Answers (2)

Answers (2)

Former Member
0 Kudos

hi Raju,

is this the output you want??

<ItemDetail>

<PartNumbers>

<SellerPartNumber>

<PARTID>111</PARTID>

</SellerPartNumber>

</PartNumbers>

<ItemDescription>xxx</ItemDescription>

</ItemDetail>

<ItemDetail>

<PartNumbers>

<SellerPartNumber>

<PARTID>222</PARTID>

</SellerPartNumber>

</PartNumbers>

<ItemDescription>yyy</ItemDescription>

</ItemDetail>

else just let me know what is your required out.

regards,

Jesse

Former Member
0 Kudos

Jesse,

Yes, that is the exact output I need, in a simplified scenario(assuming I am dealing only with QUALF=002 for Partnumber, and QUALF=001 for description)This will become more complex if I get a buyer part number also, but for now, this is the output I needed.

thank you and appreciate any insight on this.

Raju

stefan_grube
Active Contributor
0 Kudos

The occurancy of Part_id is 1..1, so you must not have a condition here.

Just do:

IDTNR[Context=E1EDP01] - PartID

KTEXT[Context=E1EDP01] - ItemDescription

E1EDP01 - ItemDetail

Constant() - PartNumbers

Constant() - SellerPartNumber

Regards

Stefan

Message was edited by: Stefan Grube