UDF user defined functions

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

10|10000 characters needed characters exceeded

• Nov 29, 2006 at 07:22 AM

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);

10|10000 characters needed characters exceeded
• Former Member
Nov 29, 2006 at 07:23 AM

take a look at this weblog...

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

10|10000 characters needed characters exceeded
• Former Member
Nov 29, 2006 at 07:23 AM

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

10|10000 characters needed characters exceeded
• Former Member
Nov 29, 2006 at 07:38 AM

Hi,

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

Regards,

Sudheer.

10|10000 characters needed characters exceeded
• Shabarish V Nair Michael Johnson

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("");