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

covert data type

Former Member
0 Likes
644

hi all,

i want to convert no like 1.200000000e2 into 0.012 here 1st no is of P data type how should i change it.

thanx.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
608
Data: W_num type p decimals 3.

W_num = '1.200000000e2'.

This will resolve the issue..

regards,

Gurpreet

4 REPLIES 4
Read only

Former Member
0 Likes
609
Data: W_num type p decimals 3.

W_num = '1.200000000e2'.

This will resolve the issue..

regards,

Gurpreet

Read only

Former Member
0 Likes
608

Defining the type as packed and giving the decimal precision will help you.

Regards,

Lalit Mohan Gupta.

Read only

Former Member
0 Likes
608

Hi,

Define a variable with decimal 3.

Then move ur value to the new variable.

DATA : W_NEW TYPE P DECIMALC 3.

WRITE W_OLD TO W_NEW DECIMALS 3.

Here W_OLD is your Exponential Value.

Read only

Former Member
0 Likes
608

Hi Bhupi,

How about making 100% your own cutom coding.

I am not sure about your full req. but i have written a sample code for you just look at that.

DATA : A1(15), B1(15), C1, D1(10) TYPE P DECIMALS 3, E1(6).

*Move your current value to a Character variable.

A1 = '1.200000000e2'.

SPLIT A1 AT 'e' INTO B1 C1.

  • Split your value accordingly

*Calculate the multiplication factor you can take upto 10000000000000. depending on your Requirement

IF C1 EQ 1.

E1 = 10.

ELSEIF C1 EQ 2.

E1 = 100.

ELSEIF C1 EQ 3.

E1 = 1000.

ELSEIF C1 EQ 4.

E1 = 10000.

ELSEIF C1 EQ 5.

E1 = 100000.

ELSEIF C1 EQ 6.

E1 = 1000000.

ENDIF.

*Your fiunal value

D1 = B1 / E1.

Thanks & Regards,

Dileep .C