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

conversion of exponential value to integer

Former Member
0 Likes
5,561

Hello All,

I have a requirement wherein i need to convert a value in exponential notation to integer value. The details are below :

DATA: L_ATFLV LIKE AUSP-ATFLV.

if L_ATFLV holds a value 1. 1.1100000000000000E+00

then it should be converted to a value 1.11

2 . if 1.1100000000000000E+03

then it should be converted to 1110.00

TIA,

Helpful ans will be rewarded

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,216

Hi,

just equate the field to a variable of type P decimals 2.

and print the variable. the variable will have the value as 1.11 for the first case and 1100.00 for the second case.

Regards,

Aswin

9 REPLIES 9
Read only

Former Member
0 Likes
2,217

Hi,

just equate the field to a variable of type P decimals 2.

and print the variable. the variable will have the value as 1.11 for the first case and 1100.00 for the second case.

Regards,

Aswin

Read only

0 Likes
2,216

try this:

data f type f.

data: i type i.

data c(20) type c value '7.77E-10'.

call function 'CHAR_FLTP_CONVERSION'

exporting string = c

importing flstr = f.

i = f.

write: f.

write: i.

Message was edited by: kishan negi

Read only

0 Likes
2,216

try KKEK_CONVERT_FLOAT_TO_CURR.

Regards,

Suresh Datti

Read only

0 Likes
2,216

hi,

Declare a variable of type P and assign the same to that variable.

data: var type <b>p.</b>

var = value.

regards,

Santosh

Read only

Former Member
0 Likes
2,216

YOu can use the write statement using the exponent addition.

REPORT zh_test1 NO STANDARD PAGE HEADING.

DATA float TYPE f value '1.1100000000000000E+03'.

WRITE (6) float EXPONENT 0.

Regards,

Ravi

Read only

Former Member
0 Likes
2,216

Hi Sharat,

Almost all data types are inter convertible..

So just assign it to a floating point variable and your query is solved.

Just check this code..

data: a type ausp-atflv.

data: b type p decimals 2.

a = '1.1100000000000000E+00'.

b = a .

write b.

Regards,

SP.

Read only

Former Member
0 Likes
2,216

try this

data : integer type i.

integer = exponent.----->(exponential variable)

Read only

Former Member
0 Likes
2,216

Try this...

data: f like AUSP-ATFLV.

data: p type p decimals 2.

f = '1.1100000000000000E+03'.

p = f.

write: f, p.

Read only

Former Member
0 Likes
2,216

Dear Sharat,

Please check this thread Simple routine to convert exponential values to float that solves this issue.

Regards,

Mohammed Mohsen