cancel
Showing results for 
Search instead for 
Did you mean: 

How to do this message mapping?

Former Member
0 Kudos

Hi XI guru,

Could you please help to take a look on following mapping requirement and give some hits, thank you.

1.Source message structure:

<ROW>

<VBELN/>

<ERDAT/>

<POSNR/>

<MATNR/>

</ROW>

and <ROW>can loop for several times. and contains item level message.

for example, one document has 2 line items, then this <ROW> will show 2 times,<VBELN> is the document number and 2 rows will be the same one, <POSNR> is the item number, will be 010,020.

eg:

<ROW>

<VBELN>10001</VBELN>

<ERDAT>20070404</ERDAT>

<POSNR>010</POSNR>

<MATNR>8081</MATNR>

</ROW>

<ROW>

<VBELN>10001</VBELN>

<ERDAT>20070404</ERDAT>

<POSNR>020</POSNR>

<MATNR>8082</MATNR>

</ROW>

<ROW>

<VBELN>10002</VBELN>

<ERDAT>20070404</ERDAT>

<POSNR>010</POSNR>

<MATNR>8083</MATNR>

</ROW>

<ROW>

<VBELN>10002</VBELN>

<ERDAT>20070404</ERDAT>

<POSNR>020</POSNR>

<MATNR>8084</MATNR>

</ROW>

2. Target message structure

<HEADER>

<item>

<VBELN></VBELN>

<ERDAT></ERDAT>

</item>

</HEADER>

<ITEM>

<item>

<VBELN></VBELN>

<POSNR></POSNR>

<MATNR></MATNR>

</item>

</ITEM>

the mapping result should be

<HEADER>

<item>

<VBELN>10001</VBELN>

<ERDAT>20070404</ERDAT>

</item>

<item>

<VBELN>10002</VBELN>

<ERDAT>20070404</ERDAT>

</item>

</HEADER>

<ITEM>

<item>

<VBELN>10001</VBELN>

<POSNR>010</POSNR>

<MATNR>8081</MATNR>

</item>

<item>

<VBELN>10001</VBELN>

<POSNR>020</POSNR>

<MATNR>8082</MATNR>

</item>

<item>

<VBELN>10002</VBELN>

<POSNR>010</POSNR>

<MATNR>8083</MATNR>

</item>

<item>

<VBELN>10002</VBELN>

<POSNR>020</POSNR>

<MATNR>8084</MATNR>

</item>

</ITEM>

How can I do this mapping using graphic mapping tool of XI, or Graphic mapping tool cannot make it?

thank you for your time and effort

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

u can check input and output of UDF in queue.....in test tab give some input...again go to design tag ...select mapping for ERDAT....and just right click on UDF and select "display queue"....n u will get how a.length works.

i hv used UDF bcoz ERDAT can b different for VBELN.

for example :

<VBELN>10001</VBELN>

<ERDAT><b>20070404</b></ERDAT>

<VBELN>10002</VBELN>

<ERDAT><b>20070405</b></ERDAT>

if its same for 10001 n 10002 then same value shd b mapped twice and if its different then values shd b mapped accordingly.

i hope its clear.

Thanks,

Maheshwari.

Message was edited by:

Maheshwari Morbale

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Qi Zhang,

I guess the above UDF will work fine..pleas let me know,did you achieved this or not and otherwise what is the error you are getting.

Thaks and Regards,

Chandu.

Former Member
0 Kudos

When I use the UDF code, I am debuging the mapping queue, following the error pop up:

Source code has syntax error: C:/usr/sap/SXI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapda417ad2e31e11dbca7f0015c5f7cd3b/source/com/sap/xi/tf/_MM_SO_DBtoRFC_New_.java:132: cannot resolve symbol symbol : method a (int) location: class com.sap.xi.tf._MM_SO_DBtoRFC_New_ result.addValue(a(i)); ^

Do you Have any idea about this? thank you for your time and effort on solving this.

Former Member
0 Kudos

o~ I see the problem, you just mistype the

result.addValue(a<b>[</b>i<b>]</b>); as result.addValue(a<b>(</b>i<b>)</b>);

I changed and things running well

Former Member
0 Kudos

Hi,

Yaa... its possible with graphical mapping.

VBELN>RemoveContext>SplitByvalue(Value Change)>collapseCotext>Item (item inside HEADER)

VBELN>RemoveContext>SplitByvalue(Value Change)>collapseCotext>SplitByValue(Each Value)-->VBELN

for ERDAT i have used UDF..it has 2 inputs

1. ERDAT>RemoveContext>SplitByvalue(Value Change)>collapseCotext-UDF---ERDAT.

2. VBELN>RemoveContext>SplitByvalue(Value Change)>collapseCotext-UDF

Now create UDF with 2 inputs a,b and Queue.

if(a.length == 1)

{

for(int i = 0 ; i<b.length; i++)

{

result.addValue(a[0]);

result.addContextChange();

}

}

else

{

for(int i = 0;i<b.length;i++)

{

result.addValue(a(i));

result.addContextChange();

}

}

ERDAT>RemoveContext>Item (item inside ITEM)

VBELN-->VBELN

POSNR-->POSNR

MATNR-->MATNR

Thanks,

Maheshwari.

Former Member
0 Kudos

Hi Maheshwari

Thank you very much for your help, I can understand the graphic mapping setting, but I still not catch the UDF program logic, could you please explain a little bit on the logic of UDF? what is a.length means? and Can I debug the java code somewhere?

Message was edited by: ZhangQi

Qi Zhang

former_member214364
Active Contributor
0 Kudos

Hi,

Could you please provide us complete source and target structures.

because mapping depends on them.

Cheers,

Jag