cancel
Showing results for 
Search instead for 
Did you mean: 

Programming concepts required to develop UDF?

Former Member
0 Kudos

Hi Experts,

i've never created an UDF, but knows the procedure how to create it.....I want to know wht are the basic java packages are required and some basic functions like setParamter(), getParameter() etc. which are important to know being an XI developer. can anyone list down those function names along with some description and details of parameters are needed...

i've gone thru SAP Help but unable to locate any such functions.......

Regards

Faisal

points will b rewarded for useful answers

Edited by: Abdul Faisal on Apr 30, 2008 7:12 PM

Accepted Solutions (1)

Accepted Solutions (1)

vijay_b4
Active Contributor
0 Kudos

Hi Abdul,

what are user defined functions and how to write user defined functions any sample codes ?

In order to create UDFs, you need to have a basic idea about using Core Java. Also, based on the kind of functonality of the code, you will need to know if you require any extra jar files.

To create a UDF, all you need to do is click on LHS icon in the graphical mapping editor. Also, keep in min that the input and otput of a udf is always in strings.

To test your functions, you can either use the test tab present in the mapping editor or you can even use the following editor(blog by Sravya):-

/people/sravya.talanki2/blog/2006/07/24/integrating-java-editor-in-xi-integration-stack

I think info will be enough for you to start off with creating and using UDFs:)

Also, since you are an ABAPer, you might be interested in this blog which discusses how to use the ABAP editor to create, modify and test java programs!:-

/people/vijayasarathy.raghunathan/blog/2005/12/28/java-editor-inside-abap

Further Infor User Defined Functions

http://help.sap.com/saphelp_nw2004s/helpdata/en/d9/718e40496f6f1de10000000a1550b0/content.htm

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

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

http://help.sap.com/saphelp_nw2004s/helpdata/en/4b/a20c4cfea96b498b1e1af3f32f0670/frameset.htm

/people/venkataramanan.parameswaran/blog/2007/02/06/is-there-a-possibility-to-access-xi-standard-functions-in-user-defined-functions-yes

User defined fuction

You can write simple or advance user defined functions in your mapping prgm and do all the manupulation . You can use simple , context or queue type of data in it .

Sample UDF which formats date

/*

Returns time in required format with milliseconds

*/

java.util.Date d = new java.util.Date();

java.text.SimpleDateFormat f

= new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

return f.format(d) ;

Reward points if this helps....

Regards

Vani.

Former Member
0 Kudos

Hi Vani,

thanx for the brief explanations.

Regards

Faisal

Answers (3)

Answers (3)

vijay_b4
Active Contributor
0 Kudos

Hi Abdul,

you are welcome.and thanks for rewarding points.

Regards

Vani.

former_member556603
Active Contributor
0 Kudos

Hi Abdil,

How to create user defined functions in xi.

Go thru this -http://www.flickr.com/photos/8764045@N06

Please follow the steps mentioned in below link

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

Also refer below links to know more about UDF

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

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

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.

Thanks,

Satya Kuamr

Reward if it is useful..

Former Member
0 Kudos

Hi,

hey can you provide me the list the of methods that are used in creation of UDF's.......i checked the web blogs no where i could able to find the methods that can be used in UDF's creations.........

REgards

faisal

former_member556603
Active Contributor
0 Kudos

Abdul,

Hope u r problem is solved..

Container Object

Use

This object enables you to cache the values that you want to read again when you next call the same user-defined function. An instance of the container object is transferred to each user-specific function by using the container parameter.

Integration

When using the container object, you do not just temporarily save values for a user-defined function, you also access the following objects as well:

● GlobalContainer object to exchange values between different user-defined functions.

● Map object to access mapping runtime constants.

Go through this links...

http://help.sap.com/saphelp_nw04/helpdata/en/e4/028c4057d5701de10000000a1550b0/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/e0/7d8e40496f6f1de10000000a1550b0/content.htm

Thanks,

Satya Kumar

Reward if it is useful........

former_member556603
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi,

I check the URL provide by you..........but i could able to find only these methods...

setParameter( )

getParameter( )

getTrace();

getTransformationParameters()

only these methods are sufficient to know or apart from these methods wht are the extra methods are required to know....

Regards

Faisal