Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I convert the floating value to decimal value

Former Member
0 Kudos
7,260

Hi all,

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

Thanks,

bsv.

5 REPLIES 5

Former Member
0 Kudos
831

delcare variable for decimal

data: var1 type p decimals 2.

var1 = <floating value>.

else

move <floating value> to var1.

Former Member
0 Kudos
831

Hi,

check this

Regards

Former Member
0 Kudos
831

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

0 Kudos
831

It works.. thanks

Former Member
0 Kudos
831

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