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

suppress zeros after decimal point

Hi,

If my quantity field only have zeros after decimals then i want to suppres the zeros after decimal point when displaying the values in alv.

How can i do that?

My field is of type QUAN 13(3) in database.

Please help..

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jan 14, 2009 at 01:33 PM

    Hi,

    U can split the value of the filed at decimal point..

    split var at '.' into var1 var2.

    var = var1.

    Regards,

    Nagaraj

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 14, 2009 at 01:41 PM

    You need to simply assign the quan field to an integer field.

    Check this.

    DATA: a TYPE p DECIMALS 2 VALUE '123.00',
          b TYPE i.
    b = a.
    WRITE: a, b..

    Add a comment
    10|10000 characters needed characters exceeded

    • you just have to check if the integer value is equal to the original (if yes, that means there were no decimals)

      <spoonfeeding>

      DATA: a TYPE p DECIMALS 2 VALUE '123.00',
            b TYPE i.
      b = a.
      IF a = b.
      WRITE: a, b.
      ENDIF.

      </spoonfeeding>

      (For the ones who suggested SPLIT: it is not possible to split numeric data types, you have to move the value to character type first.)

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.