Skip to Content
avatar image
Former Member

Number Validation

Hi All,

Is there any function module to validate a given value is number or not? (Fm to validate a number).

Thx

- Senthil Bala

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    May 04, 2006 at 05:17 AM

    Hi,

    I don't think so, but you can simply check of the variable contains anything else other than 0 to 9. That will tell you if there are non-numeric characters.

    Amit's code is not taking care of the special characters.

    regards,

    Ravi

    note : Please mark the helpful answers

    Message was edited by: Ravikumar Allampallam

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 04, 2006 at 05:16 AM

    Hi senthil,

    1. we can use this kind of logic.

    2. just copy paste in new program.

    It will give X , if number, other wise blank

    3.

    report abc.

    parameters : n(10) type c.

    data : flag type c.

    perform isnumber using n flag.

    write :/ flag.

    *----


    form isnumber using str flag.

    flag = 'X'.

    if str ca sy-abcde.

    flag = ''.

    endif.

    endform.

    regards,

    amit m.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 04, 2006 at 05:23 AM

    Hi Senthil.

    You can do it this way.

    data : numeric_data(10) TYPE c VALUE '0123456789'.

    IF infile-order CO numeric_data.

    /* Contains only numerals

    else.

    /* Is alphanumberic.

    Endif.

    Regards,

    Susmitha

    Add comment
    10|10000 characters needed characters exceeded