2008 Feb 25 1:13 PM
Hi all,
Could any body tell me how to convert the floating value to Decimal value.
Thanks,
bsv.
2008 Feb 25 1:15 PM
delcare variable for decimal
data: var1 type p decimals 2.
var1 = <floating value>.
else
move <floating value> to var1.
2008 Feb 25 1:18 PM
2008 Feb 25 1:20 PM
Use Function module :
CALL FUNCTION 'FLTP_CHAR_CONVERSION_FROM_SI'
EXPORTING
char_unit = 'EA'
unit_is_optional = 'X'
decimals = 0
exponent = 0
fltp_value_si = lv_atwrt_temp
indicator_value = 'X'
masc_symbol = '_'
IMPORTING
char_value = lv_atwrt
EXCEPTIONS
no_unit_given = 1
unit_not_found = 2
OTHERS = 3.
or else check the below code
Declare it as type P
i.e,
Data : v_float type f,
v_dec type p decimals 3.
v_dec = v_float.
write : v_float, v_dec.
Thx
Jagadeesh
2020 Jul 27 3:48 PM
2008 Feb 25 1:21 PM
Hello,
First convert the Floating point value to char type then move to decimal.
DATA: CHAR1(30).
WRITE: OUTPUT_CHAR_TAB-ATFLV TO CHAR1 EXPONENT 0 DECIMALS 3.
CONDENSE CHAR1 NO-GAPS.
data: output type p decimals 3.
write char to output.
write output.
Cheers,
Vasanth