Skip to Content
author's profile photo Former Member
Former Member

value with upto 4 dacimal places

Hi gurus,

i want to pick a value upto 4 dacilam places. how can i do it.

or examp.

say value 4.7456660000000000000

i want only 4.7456 from above value.

plz help

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2007 at 09:27 AM

    Declare the variable with addition decimals 4

    eg

    data: price TYPE p DECIMALS 4.

    This will do it

    Reward points if it does

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2007 at 09:27 AM

    data: pd(10) type p decimals 6 value '100.123030',

    pd1(10) type p decimals 4.

    pd1 = pd.

    write: pd, pd1.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2007 at 09:33 AM

    hi! Rajesh

    Declare the variable by specifying the Decimals

    data: total type P decimals 4.

    this will eliminate the excess decimal value than you specify

    Regards,

    Nagulan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2007 at 09:34 AM

    You can also use the function module C147_STRING_TRUNCATE for this . you have input the length yu want to get.

    Hope this helps.

    Amit

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2007 at 09:44 AM

    Hi,

    Use the below logic

    data: val1 type p decimals 14 value '4.7456660000000000000'.

    data val1_text(30).

    data: val2(20).

    DATA: val3(30).

    val1_text = val1.

    split val1_text at '.' into val1_text val2.

    condense: val1_text, val2.

    concatenate val1_text val2+0(4) into val3 separated by '.'.

    write: val3.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 18, 2007 at 09:48 AM

    hi,

    declare as.........

    data: num type p decimals 4 value '4.7456660000000000000'.

    write: / num.

    it works....

    <b>reward with points if useful.</b>

    regards,

    Vinod Samuel.

    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.