Application Development and Automation 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: 
Read only

Convert String to Number

Former Member
0 Likes
8,243

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
Read only

Former Member
0 Likes
2,497

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

Read only

Former Member
0 Likes
2,497

CHECK THIS

CONVERT_STRING_TO_INTEGER

Read only

anversha_s
Active Contributor
0 Likes
2,497

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

Read only

0 Likes
2,497

HI,

use FM <b>CONVERT_STRING_TO_INTEGER </b>

regards,

Santosh

Read only

Former Member
0 Likes
2,497

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

Read only

Former Member
0 Likes
2,497

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

Read only

Former Member
0 Likes
2,497

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