09-04-2008 1:45 AM
Can someone tell me,
how we can convert the 1.9500000000000001E-01 to Numeric Value?
Thanks,
Archana.
09-04-2008 6:13 AM
Hi,
plz check the below code :
data : w_float type f value '3.339000000000000E+02',
w_character type ausp-atwrt,
w_number(10) TYPE P DECIMALS 1.
CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'
EXPORTING
float_imp = w_float "Feld TYPE F
format_imp = w_number "Field Format
round_imp = ' ' "Round off
IMPORTING
char_exp = w_character. "Feld TYPE C
Write : w_character.
Output : 333.9
thanx.
09-04-2008 1:55 AM
Simply assign this F type variable to a P type varaible:
DATA: num1 TYPE F VALUE '1.95E-01',
num2 TYPE P DECIMALS 3.
num2 = num1.
WRITE: / num2.
Just make sure you target variable is properly defined to accomodate the exponential or else it will dump
You can also use FM: CEVA_CONVERT_FLOAT_TO_CHAR
If you search the forum you will get more solutions.
09-04-2008 4:20 AM
Hi Archana,
Use the function module :
CEVA_CONVERT_FLOAT_TO_CHAR
Check this sample:
CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'
EXPORTING
float_imp = w_float -->Feld TYPE F
format_imp = w_number -->Field Format
round_imp = ' ' -->Round off
IMPORTING
char_exp = w_character. -->Feld TYPE C
Regards,
Chandra Sekhar
09-04-2008 4:35 AM
HI,
You can do this way...
Data:
float type f,
pack type p decimals(2).
give that value to the float and assign it to pack...
Pack = float.
or else if you want that value into character the use the function module to convert the float value
to decimal.
Please check this thread
You can also use FLTP_CHAR_CONVERSION.
And once if you convert to char then assign that to numeric variable so that to get a value into
numeric variable.
Hope this would help you.
Good luck
Narin
09-04-2008 5:53 AM
09-04-2008 6:13 AM
Hi,
plz check the below code :
data : w_float type f value '3.339000000000000E+02',
w_character type ausp-atwrt,
w_number(10) TYPE P DECIMALS 1.
CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'
EXPORTING
float_imp = w_float "Feld TYPE F
format_imp = w_number "Field Format
round_imp = ' ' "Round off
IMPORTING
char_exp = w_character. "Feld TYPE C
Write : w_character.
Output : 333.9
thanx.