Skip to Content
author's profile photo Former Member
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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 25, 2008 at 01:18 PM

    Hi,

    check this

    Rounding a float value.

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    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

    Jagadeesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.