Skip to Content

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 29, 2006 at 07:38 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded