Skip to Content
author's profile photo Former Member
Former Member

HI FM TO CONVERT STRING TO NUMBER

HI ALL,

CAN U PLZ TELL ME ANY FUNCTION MODULE NAME TO CONVERT STRING TO NUMBER. THANKS IN ADVANCE,

REGARDS,

MAHESH

9321043028

Add comment
10|10000 characters needed characters exceeded

6 Answers

  • Posted on Aug 30, 2007 at 11:39 AM

    Hi..

    This is the FM.

    CONVERT_STRING_TO_INTEGER

    <b>reward if Helpful</b>

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 30, 2007 at 11:43 AM

    Hi Mahesh,

    I think such kind of facility is not available, coz, string may also contain characters, so converting chracters into numbers is not making any sense, so it may not be possible, if u want any parts of the the string you can go for offset method and can extract the required part.

    Regards,

    Sujatha

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 30, 2007 at 11:44 AM
    Hi Mahesh,
    
     chk this
    
    REPORT ZTEST.
    
    DATA : V_STR TYPE STRING,
           V_NUM LIKE CATS_ITS_FIELDS-NUM_VALUE.
    
    V_STR = '2345687813'.
    
    CALL FUNCTION 'CATS_ITS_MAKE_STRING_NUMERICAL'
      EXPORTING
        INPUT_STRING  = V_STR
      IMPORTING
        VALUE         = V_NUM
      EXCEPTIONS
        NOT_NUMERICAL = 1
        OTHERS        = 2.
    
    WRITE : V_NUM.
    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 30, 2007 at 11:46 AM

    Hi Mahesh,

    The function module <b>CONVERT_STRING_TO_INTEGER</b> converts string to number. If you have any alphabets in your string then it will return zero, it will convert into number only your string completely contains numbers only.

    <b>Friendly Note: </b>You have many open threads. Plz close the threads if they are answered/solved and reward points for helpful answer

    Thanks,

    Vinay

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 30, 2007 at 11:47 AM

    Hi

    WOSI_CONVERT_STRING_TO_NUM

    this is the FM

    reward if usefull

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 30, 2007 at 07:16 PM

    Hello Mahesh

    If your string should contain only numeric values (without decimals) then you should first check the string using fm <b>NUMERIC_CHECK</b> whether it is indeed a numeric string.

    Regards

    Uwe

    Add comment
    10|10000 characters needed characters exceeded