Former Member

# How can I convert the floating value to decimal value

Hi all,

Could any body tell me how to convert the floating value to Decimal value.

Thanks,

bsv.

10|10000 characters needed characters exceeded

### Related questions

• Former Member
Posted on Feb 25, 2008 at 01:15 PM

delcare variable for decimal

data: var1 type p decimals 2.

var1 = <floating value>.

else

move <floating value> to var1.

10|10000 characters needed characters exceeded
• Former Member
Posted on Feb 25, 2008 at 01:18 PM

Hi,

check this

Rounding a float value.

Regards

10|10000 characters needed characters exceeded
• Former Member
Posted on Feb 25, 2008 at 01: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

10|10000 characters needed characters exceeded
• Former Member
Posted on Feb 25, 2008 at 01: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