cancel
Showing results for 
Search instead for 
Did you mean: 

UDF?

Former Member
0 Kudos

Hi Experts,

can anyone suggest me weblog(s) which explains step by step procedure to create an UDF?

Regards

Faisal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Abdul,

Activities

1. To create a new user-defined function, in the data-flow editor, choose Create New Function (This

graphic is explained in the accompanying text), which is located on the lower left-hand side of the

screen. In the menu, choose Simple Function or Advanced Function.

2. In the window that appears, specify the attributes of the new function:

Name

Technical name of the function. The name is displayed in the function chooser and on the data-flow

object.

Description

Description of how the function is used.

Cache

Function type (see above)

Argument Count

In this table, you specify the number of input values the function can process, and name them. All

functions are of type String.

3. In the window that appears, you can create Java source code:

...

a. You can import Java packages to your methods from the Imports input field, by specifying them

separated by a comma or semi-colon:

You do not need to import the packages java.lang., java.util., java.io., and java.lang.reflect. since

all message mappings require these packages and therefore import them. You should be able to

access standard JDK and J2EE packages of the SAP Web Application Server by simply specifying the

package under Import. In other words, you do not have to import it as an archive into the Integration

Repository. You can also access classes of the SAP XML Toolkit, the SAP Java Connector, and the

SAP Logging Service (see also: Runtime Environment (Java-Mappings)).

In addition to the standard packages, you can also specify Java packages that you have imported as

archives and that are located in the same, or in an underlying software component version as the

message mapping.

b. Create your Java source text in the editor window or copy source text from another editor.

4. Confirm with Save and Close.

5. User-defined functions are limited to the message mapping in which you created the function. To

save the new function, save the message mapping.

6. To test the function, use the test environment.

The new function is now visible in the User-Defined function category. When you select this category,

a corresponding button is displayed in the function chooser pushbutton bar. To edit, delete, or add the

function to the data-flow editor, choose the arrow next to the button and select from the list box

displayed.

Regards

Seshagiri

Answers (3)

Answers (3)

Former Member
0 Kudos
Former Member
0 Kudos

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.

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

Former Member
0 Kudos

Hi,

And also check these

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

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

Regards

Seshagiri

Former Member
0 Kudos

Hi,

I've checked the web blogs but cudn't find any procedure to create UDF?

Plz check them.........

regards

Faisal

Former Member
0 Kudos

Hi Abdul,

Check my First reply that is with step-by-step creation of UDF in Message mapping Editor

Regard

Seshagiri

former_member556603
Active Contributor
0 Kudos

Hello Abdul,

step-by-step creation of UDF in Message mapping Editor

To create a new user-defined function, choose Create New Function () in the data-flow editor at the bottom of the screen, on the left-hand side.

2. Specify the attributes of the new function in the subsequent window:

Name:

Technical name of the function. The name is displayed in the function chooser and on the data-flow object.

Description:

Description of how the function is used.

Cache:

Function type (see above).

Arguments:

In this table, you specify the number of input values the function can process, and name them. All functions are of type String.

3. In the subsequent window, you can create Java source code:

a. You can import Java packages to your methods from the Imports input field, by specifying them separated by a comma or semi-colon:

You do not need to import the packages java.lang., java.util., java.io., and java.lang.reflect. since all message mappings require these packages and therefore import them. You should be able to access standard JDK and J2EE packages of the SAP Web Application Server by simply specifying the package under Import. In other words, you do not have to import it as an archive into the Integration Repository. You can also access classes of the SAP XML Toolkit, the SAP Java Connector, and the SAP Logging Service (see also: Runtime Environment (Java-Mappings)).

In addition to the standard packages, you can also specify Java packages that you have imported as archives and that are located in the same, or in an underlying software component version as the message mapping.

b. Create your Java source text in the editor window or copy source text from another editor.

4. Confirm with Save and Close.

5. User-defined functions are limited to the message mapping in which you created the function. To save the new function, save the message mapping.

6. To test the function, use the test environment.

The new function is now visible in the User-Defined function category. When you select this category, a corresponding button is displayed in the function chooser pushbutton bar. To edit, delete, or add the function to the data-flow editor, choose the arrow next to the button and select from the list box displayed.

Thanks,

satya kumar

Reward if it is useful...

Edited by: SATYA KUMAR AKKARABOYANA on Apr 22, 2008 12:12 PM