2008 Jun 17 7:48 AM
I HAVE A VARIABLE OF TYPE FLOAT WITH VALUE : 3.339000000000000E+02
I WANT TO CONVERT THE VALUE INTO A VARIABLE TYPE CHAR(30).
AND THE EXPECTED RESULT VALUE IS '333.9'
HOW DO I DO IT.
2008 Jun 17 7:51 AM
Hi Ravinder
Use the Function Module: CEVA_CONVERT_FLOAT_TO_CHAR
&********* Reward Point if helpfull******************&
2008 Jun 17 7:55 AM
2008 Jun 17 8:05 AM
Tried the FM but no results..........can someone tell how to use the FM .......the parameters that I have to pass....detaily please...
I see there are four IMPORT parameters :
where should :'3.339000000000000E+02' sit in those parameters.
2008 Jun 17 8:11 AM
Hi ravinder,
Please go through the link for the Thread I posted above you will get the answer for sure.
Regards
Hemant Khemani
2008 Jun 17 8:00 AM
Hi,
Try this,
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
Adil
2008 Jun 17 8:29 AM
Can someone make changes in this code : So that I can use it
data : w_float type f value '3.339000000000000E+02',
w_character type ausp-atwrt,
w_number type f.
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
2008 Jun 17 9:08 AM
Hi ravinder,
Please use this 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
Reward points if helpful.
Regards
Hemant Khemani
2010 Dec 20 10:39 AM
Hi
I m also facing this problem.
you should take float value for calulation as its.
For Out put display you should convert as a character format.
Example
data : a(20),
data : b(5),
data : n type f.
n = 3.3330000000E+02.
a = n.
b = a.
Output : 3.33
2011 Aug 04 4:08 AM
a simple method to convert
DATA LV_F TYPE F.
LV_F = '3.339000000000000E+02'.
DATA LV_P(12) TYPE P DECIMALS 2.
LV_P = LV_F.
DATA LV_I TYPE I.
LV_I = LV_F.