Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

HI FM TO CONVERT STRING TO NUMBER

Former Member
0 Kudos

HI ALL,

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

REGARDS,

MAHESH

9321043028

6 REPLIES 6

varma_narayana
Active Contributor
0 Kudos

Hi..

This is the FM.

CONVERT_STRING_TO_INTEGER

<b>reward if Helpful</b>

Former Member
0 Kudos

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

Former Member
0 Kudos
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.

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi

WOSI_CONVERT_STRING_TO_NUM

this is the FM

reward if usefull

uwe_schieferstein
Active Contributor
0 Kudos

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