cancel
Showing results for 
Search instead for 
Did you mean: 

Multi mapping question using user defined function

Former Member
0 Kudos

Hi,

I have a message with multiple occuring nodes (i.e. one message with multiple orders (header + detail)) that I need to map to a idoc. I need to filter out of the source based on order type (in header) from creating an idoc.. How do I do it using user defined function + message mappping ?

mad

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

hi,

You can use the in built IF THEN function provided in your graphical mapping to do this.

http://help.sap.com/saphelp_nw04/helpdata/en/5d/db0e83e8e74202a5bff527055ab7e5/content.htm

Regards,

Bhavesh

Answers (5)

Answers (5)

Former Member
0 Kudos

All - Merci for your answers. I wrote some functions using hints provided here and was able to work it out. Just like everybody else, I felt the same dilemna in terms of rewarding the best answer but I have done my best to spread out the points for your enthusiastic responses.. This forum is awesome !

thanks again

mad

moorthy
Active Contributor
0 Kudos

Maddux~,

Create a Mapping with Inuilt functions of Mapping i,e Contex Change, Remove Context, SplitByValue will resolve the issue.

Just Refer-

/people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i

/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii

Hope this helps

Regards,

Moorthy

Former Member
0 Kudos

All - Thanks much.. Here is my requirement that is no solved by regular mapping

<Root>

<Recordset>

<Ordheader>

<ord>

<ord_type>

</Ordheader>

<Ord_line>

<ord>

<Linnum>

</Ord_line>

</Recordset>

<Recordset>

<Ordheader>

<ord>

<ord_type>

</Ordheader>

<Ord_line>

<ord>

<Linnum>

</Ord_line>

</Recordset>

<Root>

As you see above, each recordset has order transaction. One Root message can contain multiple of these. So, when I map to the IDOC, I want to filter out any ord_type <> XX.

If I use regular graphical map, it only looks at first recordset and accepts all or rejects all.

I need to use UDF. In the UDF, what comes in as input ? Resultset is output -correct ? Now how do I usse graphical mapping with UDF to generate the correct target info

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Removing Context and then using if--then will solve your problem.

This blog will explain how to use contexts in message mapping,

/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii

Regards,

bhavesh

Former Member
0 Kudos

Hi,

If I understood you correctly, you want to map a message to an idoc structure based on some condition of the field <ordertype>

You have not specified the occurance of this order type.

If you have to map many order types to a field in the target(based on some condition) make sure that this field has an occurance of 0 to unbounded.

The corresponding field in the target idoc too, must be of occurence 0..ub.

If the idoc field does not have this occurence, then would have to import the idoc as an xsd and change the occurence.

After this is checked, you could do a normal graphical mapping to check the condition.

If <ordertype>>equals>"value"->then> <Tordertype>

Regards,

Smitha.

Former Member
0 Kudos

Hi Maddux,

Please go through this thread and see the replies given to a question which talks about a similar need as yours.

Regards,

abhy