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: 

Convert String to Number

Former Member
0 Kudos

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)

7 REPLIES 7

Former Member
0 Kudos

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

Former Member
0 Kudos

CHECK THIS

CONVERT_STRING_TO_INTEGER

anversha_s
Active Contributor
0 Kudos

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

0 Kudos

HI,

use FM <b>CONVERT_STRING_TO_INTEGER </b>

regards,

Santosh

Former Member
0 Kudos

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...

Former Member
0 Kudos

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

Former Member
0 Kudos

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