Skip to Content
avatar image
Former Member

Not required to print decimal places

Hi,

In the sapscript for printing production order, we are printing the order quantity field MGVRG

present in the structure AFVGD. &AFVGD-MGVRG&

But we dont want the decimal places to be printed.

Suppose if the quantity is 10,000 it should be printed as 10.

I tried using &AFVGD-MGVRG(.0)& , but no result.

Please let me know how we can achieve this.

Thanks in advance,

Poornima

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Jan 21, 2009 at 11:14 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 21, 2009 at 12:13 PM

    Hi Poornima,

    Get the value of your field i.e AFVGD-MGVRG into a variable of type p deciamal 2 as shown in the code below.

    DATA a TYPE I.

    DATA b TYPE P DECIMALS 2 VALUE '10.15'.

    a = TRUNC( b ).

    WRITE: / 'TRUNC:', a.

    Let me know if this is useful

    Nayan

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 21, 2009 at 01:17 PM

    Hello,

    Suppose if the quantity is 10,000 it should be printed as 10.

    I tried using &AFVGD-MGVRG(.0)& , but no result.

    I see that the decimal separator is comma(,).

    Plz change &AFVGD-MGVRG(.0)& to

    &AFVGD-MGVRG(,0)&

    BR,

    Suhas

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 30, 2009 at 05:53 AM

    Hi poornima,

    Do one thing.

    Declare one field as

    Data z_mgvrg TYPE i. in your driver program.

    Now z_mgvrg = AFVGD-MGVRG.

    No print &z_mgvrg& in your script.

    hope it will help you.

    regrds,

    Lokesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 30, 2009 at 06:56 AM

    DATA: val TYPE P DECIMALS 2 VALUE 1000.00 ,

    Amt type i.

    Amt = TRUNC( val ).

    WRITE: / Amt.

    Regards,

    Joan

    Add comment
    10|10000 characters needed characters exceeded