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

Data type conversion

Former Member
0 Likes
447

Hi,

i need to convert string to decimals.string has a value 98.00% i want to assign this to dec as .98

if any links for data type convertion.i.e from which type to which type we can assign.

please send me links.

thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
420

Hi,

I think there will be a Function Module for this, but i don't have a system available to check.

You can do it with your own coding as follows:

data: lv_string type string,
      lv_int    type i,
      lv_result type p decimals 2.

lv_string = '98.00%'.

replace '%' in lv_string with ''.

move lv_string to lv_int.

lv_result = lv_int / 100.

I suppose this to work.

Regards,

Roelof

2 REPLIES 2
Read only

Former Member
0 Likes
420

Divide the number by 100 after assigning to the variable

data : string1 type string value '98.00'.

data : v_dec type ANZHL.

v_dec = string1.

v_dec = v_dec / 100.

Read only

Former Member
0 Likes
421

Hi,

I think there will be a Function Module for this, but i don't have a system available to check.

You can do it with your own coding as follows:

data: lv_string type string,
      lv_int    type i,
      lv_result type p decimals 2.

lv_string = '98.00%'.

replace '%' in lv_string with ''.

move lv_string to lv_int.

lv_result = lv_int / 100.

I suppose this to work.

Regards,

Roelof