‎2006 May 31 1:57 PM
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
‎2006 May 31 1:59 PM
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
‎2006 May 31 1:59 PM
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
‎2006 May 31 2:00 PM
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
‎2006 May 31 2:00 PM
‎2006 May 31 2:01 PM
hi,
Declare a variable of type P and assign the same to that variable.
data: var type <b>p.</b>
var = value.
regards,
Santosh
‎2006 May 31 2:00 PM
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
‎2006 May 31 2:01 PM
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.
‎2006 May 31 2:03 PM
try this
data : integer type i.
integer = exponent.----->(exponential variable)
‎2006 May 31 2:04 PM
Try this...
data: f like AUSP-ATFLV.
data: p type p decimals 2.
f = '1.1100000000000000E+03'.
p = f.
write: f, p.
‎2013 Jul 11 11:36 PM
Dear Sharat,
Please check this thread Simple routine to convert exponential values to float that solves this issue.
Regards,
Mohammed Mohsen