cancel
Showing results for 
Search instead for 
Did you mean: 

idoc to cXMLmapping..user defined function help

Former Member
0 Kudos

hello Everybody,

I am new to XI and I am working on a new mapping. In a nutshell, the requirement is to concat the TDLine of segment E1EDPT2 and map the data to comments of the cXML. The segment E1EDPT2 is segment in E1EDP01( Purchase Order line item segment) This the data that is coming from the vendor text of the SRM system. This needs to repeat for each line item in the Purchase Order. I have created a user defined function which concats the TD lines but I am not able to differenciate the tD line for other line items. Please help. I would appreciate it if anyone could share the User Defined function which suits my needs.

Thanks!

<E1EDP01> (PO lIne Item 1)

<E1EDPT1 SEGMENT="1">

<TDID>F01</TDID>

<TSSPRAS>E</TSSPRAS>

<TSSPRAS_ISO>EN</TSSPRAS_ISO>

<E1EDPT2 SEGMENT="1">

<TDLINE>XI mapping test - Newline1</TDLINE>

<TDFORMAT>*</TDFORMAT>

</E1EDPT2>

<E1EDPT2 SEGMENT="1">

<TDLINE>Line1- text2 end</TDLINE>

<TDFORMAT>*</TDFORMAT>

</E1EDPT2>

<E1EDPT2 SEGMENT="1">

<TDLINE>Line1 - text3</TDLINE>

<TDFORMAT>*</TDFORMAT>

</E1EDPT2>

</E1EDPT1>

</E1EDP01>

<E1EDP01> ( PO lien item 2)

<E1EDPT1 SEGMENT="1">

<TDID>F01</TDID>

<TSSPRAS>E</TSSPRAS>

<TSSPRAS_ISO>EN</TSSPRAS_ISO>

<E1EDPT2 SEGMENT="1">

<TDLINE>XI mapping test - line2</TDLINE>

<TDFORMAT>*</TDFORMAT>

</E1EDPT2>

</E1EDPT1>

</E1EDP01>

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

When you say:

<i>I have created a user defined function which concats the TD lines but I am not able to differenciate the tD line for other line items</i>

I am not sure exactly what you mean. Your UDF should concat all values coming into it I assume? So you only map the TDLINE segment with that UDF that way you know what values are coming into correct? Maybe I am misunderstanding your question.

Former Member
0 Kudos

Hi Harrison,

Thanks for your reply. What I meant was if Line 1 had 3 TDlines and Line 2 has one tD line, I have a user defined function which concats the 3 TDlines from Line 1 and also the one TDline of line 2 to make it one huge text, when this UDF is mapped, it maps to only one line item of cXML. The perfect solution would be. To map the 3 TD lines ( CONCAT) of Idoc Line Item 1 to Line item of cXML and the TD line of idoc Line item 2 to second Line item of CXML. I hope I did not confuse

Former Member
0 Kudos

Ah, it sounds like you are going to have to work with context changes. Check my blog about working with UDF's and context changes:

/people/harrison.holland5/blog/2006/12/08/mapping-context-changes-in-xi

Also, you will probably need to check out this page:

http://help.sap.com/saphelp_nw04/helpdata/en/f8/2857cbc374da48993c8eb7d3c8c87a/content.htm

That deals with the function calls you can take advantage of for manipulating context's in your UDF

Former Member
0 Kudos

Keep in mind, that when you are working with multiple entries of the same field name within a parent node, your input is going to be an array in your advanced UDF. So you can test to see if your input array's length is greater than 1 in order to find out if there was more than one instance of that field in a particular parent node.

Former Member
0 Kudos

From the problem description I understand that you have to manage the context of the second line element. use display queue to understand how the values of elements are being passed to the UDF.

Follow the blog Harrison has mentioned, shoudl help