cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding UDF's in Mapping

Former Member
0 Kudos

Hi,

I want to Know some Situations where a Developer is going to Use the UDF for the Requirement in the Mapping????

I want Some Possible Casess and the COrresponding UDF's also..

Regards

Suman

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

their could be (a lot of times situations where you can't handle your problem with the standard functions in message mapping.

In this case you can use user defined functions.

As they are written in JAVA you can do almost everything you want to do.

The description of udfs (+ some examples) is given here:

http://help.sap.com/saphelp_nw04/helpdata/en/d9/718e40496f6f1de10000000a1550b0/frameset.htm

There are a lot of examples in this forum already.

For example here:

Regards

Patrick

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

For business requirement and business logic we have to write UDFs.check some exaples.

UDF

http://flickr.com/photos/8764045@N06/

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e...

Example 1

http://www.flickr.com/photo_zoom.gne?id=544183191&size=o

http://www.flickr.com/photo_zoom.gne?id=544183195&size=o

http://www.flickr.com/photo_zoom.gne?id=544183225&size=o

http://www.flickr.com/photo_zoom.gne?id=544183233&size=o

Example 2

http://www.flickr.com/photo_zoom.gne?id=545133789&size=o

http://www.flickr.com/photo_zoom.gne?id=545133791&size=o

http://www.flickr.com/photo_zoom.gne?id=545133801&size=o

http://www.flickr.com/photo_zoom.gne?id=545133807&size=o

http://www.flickr.com/photo_zoom.gne?id=545133811&size=o

http://www.flickr.com/photo_zoom.gne?id=545138911&size=o

http://www.flickr.com/photo_zoom.gne?id=545138913&size=o

http://www.flickr.com/photo_zoom.gne?id=545138915&size=o

http://www.flickr.com/photo_zoom.gne?id=545138917&size=o

http://www.flickr.com/photo_zoom.gne?id=545138947&size=o

http://www.flickr.com/photo_zoom.gne?id=545138951&size=o

http://www.flickr.com/photo_zoom.gne?id=545005958&size=o

Example 3

http://www.flickr.com/photo_zoom.gne?id=549186611&size=o

http://www.flickr.com/photo_zoom.gne?id=549186651&size=o

http://java.sun.com/j2se/1.5.0/docs/api/

/people/krishna.moorthyp/blog/2006/07/29/documentation-html-editor-in-xi

/people/sap.user72/blog/2006/02/06/xi-mapping-tool-exports

http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm

/people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio

http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d046c490-0201-0010-84b6-9df523cb...

Regards,

Phani

Reward points if Helpful

Jitendra_Jeswan
Contributor
0 Kudos

I use UDF in the following conditions:

1) When data need to be retreived from tables

2) Data manipulation using loops/conditions

3) Mapping lookups (RFC/DB)

4) Dynamic configuration to generate File names dynamically..

5) manipulating contexts and generating some custom queues to be used in Mapping.

6) Many other scenarios in which the stnd functions cannot achieve the desired result.

Regards.

Jeet.

Former Member
0 Kudos

Hi,

U can use UDF user defined function in graphical mapping if ur business requirements are not fulfiled by std functions.

UDF's are user defined functions are of two types,simple UDF which takes in one input and gives out one output and the second one is advanced UDF where in u can access more than one fields,and the result is passed on to ResultList.

UDF can be used in graphical mapping depends upon the requirement.

1) If u wanted to do manuplication in data which can not be done by using the standared XI function that time we go for UDF.

2) For doing Lookup we write the code in UDF and pass the value to R3 system.

Lookup - /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer

DB lookup - /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler

SOAP Lookup - /people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function

3) If u need to compare the input value and pass the other value based on comparision that time can go for UDF.

here u need to write

if(A.equals("somevalue"))

{

output Somevalue

}

else

{

output different value

}

4) IF u have a requirement where u need to dynamically take the value from file adapters then u write UDF.

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

/people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping

There are many different requirement for which we can go ahead with UDF.

Thnx

Chirag

Edited by: Chirag Gohil on Feb 20, 2008 2:00 PM

Former Member
0 Kudos

Hi,

In addition to Chirag's points:

When you are passing data from IDoc to FLAT FILE,

If you use standard Date Format function such as DATE TRANS in Mapping to translate date from SAP format to File format, you need to compulsory pass the value in Date field in IDoc. Suppose if you miss the value in the Date Field, Mapping will not work. Runtime Exception will be triggered.

The same problem will exist, if you use Arithmetic functions such as: multiply, divide and so on.

So Inorder to overcome these issues we can go for UDF's.

Thanks,

Kishore.