07-08-2010 1:32 PM
Hi all,
I have a requirement where i have to find sum of mseg-menge , opening stock , closing stock.
so i wrote the code as below:
loop at it_s032 into wa_s032.
c = wa_s032-mbwbest + sum2 + sum1 - wa_s032-mkobest.
diff = wa_s032-mbwbest - wa_so32-mkobest.
ENDLOOP.
where, sum2 is the sum calculated for mseg-menge based on mblnr,and
sum1 is the sum calculated for mseg-menge based on matnr.
error: Arithematic operations are only intended for operands that can be converted to numbers.
please suggest for this problem.
data declaration:
data: sum2 type i,
sum1 type i,
c type menge,
diff type menge.
regards,
asha
07-08-2010 1:36 PM
fine there we got the problem.
data type of c and diff is MENGE.
now have a look at type menge with SE11, you won't be astonished it doesnt work since MENGE is a flat structure but not a dataelement. you might want to use some type p length 12 decimals 2 stuff or kbetr or whatever, just make sure it is numeric if you want to calculate with it.
Edited by: Florian Kemmer on Jul 8, 2010 2:37 PM
07-08-2010 1:37 PM
Hi,
if you check the type of menge its a structure.
So declare that sum and diff with table-menge
like eg: mseg-menge .
After check the code.
Hope this might solve your problem
With Regards,
Sumodh.P