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

deleting trailing zeros after the decimal point

Hi All,

I am working on SAP Scripts.I have a Quantity field in my Script.

when we display the Script the ouput due to this quantity field is smething like 10.000

but i need to display only 10

and if the value is 10.100

then i need to display 10.100

please send your useful inputs.

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2008 at 11:51 AM

    Hi,

    First write the value to a character string.

    Then replace .000 with null. (if not found nothing happens)

    For example;

    data lv_qty type vbap-zmeng.
    data char_qty(10).
    
    lv_qty = '10.000'.
    Move lv_qty TO char_qty.
    Replace '.000' IN char_qty  WITH ''.
    CONDENSE char_qty.
    write / char_qty. " output 10
    lv_qty = '10.100'.
    Move lv_qty TO char_qty.
    Replace '.000' IN char_qty  WITH ''.
    CONDENSE char_qty.
    write / char_qty. " output 10.100

    Likewise you have to adapt this to your requirement, revert back if u have doubts.

    Regards

    Karthik D

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2008 at 11:41 AM

    Hi,

    Use the FM : ROUND...

    Or use a statement SPLIT at '.' (dot)...

    Regards

    Shiva

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2008 at 12:17 PM

    Hi vidya,

    ex: &EKPO-MENGE&(.0)

    Refer this link

    [SAPscript symbols|http://firstsapabap.googlepages.com/SAPscript5_sssymbl.pdf]

    Regards,

    Sravanthi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2008 at 11:48 AM

    This message was moderated.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 29, 2008 at 01:59 PM

    Hi Karthik...........the problem is solved thank you.....I have marked the question as answered..........thanks for all of you for taking time to find the answer

    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.