Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Quantity Field

Former Member
0 Likes
1,958

Hi Friends,

I have used a quantity field of type mseg-erfmg in a query report, when i am multiplying it by gross weight which is also of same data type it is not giving me proper results.

Ex: 4.000 * 0.750 it is giving me as 3000 instead of 3.

But 4.000 + 0.750 is 4.750 which is right.

It is considering 4.000 as 4000. I tried moving it to a data type declared of type p decimals 0, then also it is coming as 4000 instead of 4.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,462

Hi Meenu,

Just check in your program this condition, every thing will be set right.

From your program, (Menu bar) Goto-> Attributes->Fixed point Airthmetic...

Make sure this field is marked,,, then check your program,

Thanks & regards,

Dileep .C

8 REPLIES 8
Read only

Former Member
0 Likes
1,462

Hi Meenu ,

This looks strange , what i would suggest is put a break point at the multiplication statement and see the values that are being used and the output also .

I think there must be some issue with the data being used in the statement , in case you are unable to figure of the issue please paste your code here , so that we can try to find the issue.

Regards

Arun

Read only

Former Member
0 Likes
1,462

Hi,

Check this code..it is working fine for me ..

DATA g_erfmg TYPE mseg-erfmg VALUE '4.000'.
DATA g_750 type mseg-erfmg VALUE '0.750'.
DATA g_value type mseg-erfmg.

g_value = g_erfmg * g_750 .
Write g_value.

Read only

Former Member
0 Likes
1,462

Use the following code.

DATA :field1 type mseg-erfmg,

field2 type mseg-erfmg,

X(15) type c.

X = field1 * field2.

Hope it will solve ur problem.

Read only

Former Member
0 Likes
1,462

Hi,

Please check the attributes of the program, if "Fixed Point arithmetic" check box is checked or not.

If the check box is not checked please activate "Fixed Point arithmetic" and execute the code.

Regards,

Shruti

Read only

Former Member
0 Likes
1,462

Hi,

Try with this,

data:w_erfmg TYPE mseg-erfmg VALUE '4.000',
      w_wt TYPE mseg-erfmg VALUE '0.750',
      w_data TYPE p DECIMALS 0.

w_data = w_erfmg * w_wt.

write w_data.

This will give u values as 3.

and if u used w_data type mseg-erfmg , it gives u value as 3.000

Thanks & Regards,

Anagha Deshmukh

Read only

Former Member
0 Likes
1,462

Yes in normal report it is working fine but I have written this code in a query report where I am facing this issue.

data : qty type mseg-erfmg,

wt type mseg-erfmg.

qty = mseg-erfmg.

wt = qty * mara-brgew.

Read only

Former Member
0 Likes
1,462

hi meenu b,

check the below code ,it might help u:-



report ZNEW32.

tables: mseg.
data: begin of itab OCCURS 0,
      mblnr like mseg-mblnr,
      matnr like mseg-matnr,
      werks like mseg-werks,
      erfmg like mseg-erfmg,
      BRGEW like mara-BRGEW,
      aa type p DECIMALS 2,
      end of itab.

PARAMETERS: plant like mseg-werks,
            mblnr like mseg-mblnr.

select a~mblnr a~matnr a~werks a~erfmg b~BRGEW
       from mseg as a INNER JOIN mara as b on b~matnr = a~matnr
       into table itab where a~werks = plant and a~mblnr = mblnr.

loop at itab.
  itab-aa = itab-erfmg * itab-brgew.
  write: / itab-mblnr,itab-matnr,itab-erfmg,itab-brgew,itab-aa.
ENDLOOP.

revert back if u need more help.

Edited by: ricx .s on May 6, 2009 7:30 AM

Read only

Former Member
0 Likes
1,463

Hi Meenu,

Just check in your program this condition, every thing will be set right.

From your program, (Menu bar) Goto-> Attributes->Fixed point Airthmetic...

Make sure this field is marked,,, then check your program,

Thanks & regards,

Dileep .C