cancel
Showing results for 
Search instead for 
Did you mean: 

UDF user defined functions

Former Member
0 Kudos

Hi,

I am a novice in java and need to write a UDF which has to calculate the length of field (material description) as input. It contains '/' symbol. The function should return the string from 0th position to '/' symbol. Thanks a lot And if possible, please send me some links which help me to learn write sample UDF for various conversions.

Michael

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Please refer this link to learn much about user defined functions.

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

Regards,

Sudheer.

Former Member
0 Kudos

Hi,

Thanks for all ur replies. I am using the below structure in message mapping

material description and constant '/' -> lastindexOf (2 parameters)->UDF

UDF ( 3 parameters) material description, start index ie 0, and last indexOf

Should Return the string till '/'.

Any help is appreciated to develop this UDF.

-Michael

Shabarish_Nair
Active Contributor
0 Kudos

reframe your build.

create a simple udf which take only one input a (material desc.)

and then put this code;

if(a.length() > 0)

{

int i = a.indexOf("/");

a = a.substring(0,i);

return(a);

}

else

return("");

Former Member
0 Kudos

Use this code

Public String replace (String a, Container container)

{

int i = a.indexOf("/");

if a>0

{

return (a.substring(0,i));

}

else

return "";

Regards,

Jai Shankar

Former Member
0 Kudos

take a look at this weblog...

/people/dennys.hsieh/blog/2006/11/20/how-to-parse-xxyyzzaabbcc112233-in-message-mapping

Shabarish_Nair
Active Contributor
0 Kudos

use this logic;

String a = "abc/123"; //say this is your input string

int i = a.indexOf("/");

a = a.substring(0,i);

System.out.println(a);

the result will be abc.

in UDF it will be in case you make a simple function;

int i = a.indexOf("/");

a = a.substring(0,i);

return(a);