Skip to Content
0
Former Member
Jan 10, 2008 at 04:00 PM

Problem with collect itab

28 Views

What is wrong with my coding?

DATA:

BEGIN OF itab1 OCCURS 0,

matnr type mseg-matnr,

mjahr type mseg-mjahr,

erfmg type mseg-erfmg,

END OF itab1.

select MATNR MJAHR ERFMG

into corresponding fields of table itab1

from mseg

where bwart = '501'.

collect itab1.

sort itab1.

I thought I get a sum per Jahr for each material. When I look into the itab I get more then one entry per year per material.

e.g.:

Mat Year Sum

123 2007 100

123 2007 009

What am I doing wrong, I thought the collect sums it up?

chris