**定义内表
data:begin of itab occurs 0 ,
type_count type i ,
mara_count type i ,
end of itab .
**定义sy-tabix .
DATA:L_INDEX LIKE SY-TABIX.
** 新增物料组计算资料到itab
select distinct count(matkl)
into itab-type_count
from mara .
append itab .
clear itab .
**更新itab
loop at itab .
l_index = sy-tabix .
select count(MATNR)
into itab-mara_count
from mara .
MODIFY itab INDEX L_INDEX.
endloop .