Application Development 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: 

alv summation problem

Former Member
0 Kudos

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

2 REPLIES 2

Former Member
0 Kudos

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

former_member536879
Active Contributor
0 Kudos

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