cancel
Showing results for 
Search instead for 
Did you mean: 

Not required to print decimal places

former_member201364
Participant
0 Kudos

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

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

DATA: val TYPE P DECIMALS 2 VALUE 1000.00 ,

Amt type i.

Amt = TRUNC( val ).

WRITE: / Amt.

Regards,

Joan

Former Member
0 Kudos

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

SuhaSaha
Advisor
Advisor
0 Kudos

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

former_member201364
Participant
0 Kudos

Hi,

When I change it to &AFVGD-MGVRG(,0)&

it is not at all priniting any value. Please let me know if there is any other way to print without decimals, when the decimal seperator is ,

thanks,

poornima

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Poornima,

I think you have to use TRUNC keyword to get the decimal value & print that in the SAPscript.

Plz search in SDN you have lots of posts on this.

[Sapscript removing 0 values |;

BR,

Suhas

Edited by: Suhas Saha on Jan 28, 2009 6:33 PM

Former Member
0 Kudos

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

Former Member
0 Kudos

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