Skip to Content
avatar image
Former Member

Convert String to Number

I want to convert a string which is a numerical value into number.....

Is there any function module that could convert string to number as how we have a fn module to covert number to string.

Please arrange me with the function module - > Converting String to Number

305(String) to be converted and read as number 305(Integer)

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Nov 21, 2006 at 12:52 PM

    Just assign it to a integer variable and vice versa.

    DATA v_i TYPE i.

    DATA v_c(20) TYPE c VALUE '305'.

    v_i = v_c.

    v_c = v_i.

    Regards

    Wenceslaus

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 21, 2006 at 12:52 PM

    CHECK THIS

    CONVERT_STRING_TO_INTEGER

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 21, 2006 at 12:52 PM

    hi,

    • Converting type c to type n

    DATA: SCN(4) VALUE '12x4',

    T1CN(2) TYPE N,

    T2CN(6) TYPE N.

    MOVE: SCN TO T1CN,

    SCN TO T2CN.

    Rgds

    Anver

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 21, 2006 at 12:54 PM

    Check this program...

    REPORT Z12TEST.

    data: str type string,

    num type i.

    str = '365'.

    num = str.

    num = num * 2.

    write: num.

    Answer is 730.....so no pbroblem at all...

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 21, 2006 at 12:58 PM

    Sandeep,

    move char to numeric as follows....

    DATA : lv_f TYPE string ,

    LV_N(10) TYPE N.

    LV_F = '23232-'.

    WRITE LV_F TO LV_N.

    IF LV_N > 0.

    WRITE:/ 'Y'.

    ELSE.

    WRITE:/ 'N'.

    ENDIF.

    and try using '<b>CATS_ITS_MAKE_STRING_NUMERICAL</b>'

    Message was edited by:

    Anupama Reddy

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 21, 2006 at 12:59 PM

    hi,

    yes there is one FM

    <b>CONVERT_STRING_TO_INTEGER</b> which converts a string into number

    which will fullfill all your requirements

    Regards

    srinivas

    Add comment
    10|10000 characters needed characters exceeded