1
我拿了一個ty_marc類型的內部表。 在這個內部表中,我用了兩個字段matnr和werks_d。 我想根據用戶提供的條目來統計工廠(marc-werks)製造的材料數量。如何在選擇的統計表中統計內部表中的字段記錄數?
我寫的代碼...
if so_matnr is not initial.
select matnr werks from marc
into table it_marc
where matnr in so_matnr.
endif.
loop at it_marc into w_marc.
write :/ w_marc-matnr. (how to count total number of material eg:- material number : 100-100 to 100-110).
w_marc-werks.
endloop.
我想算材料的總數,並在同一個內部表的另一字段中顯示計數。 注意:材料編號100-100可能有10種材料,所以我希望在同一內部表的另一個字段中計數爲10,並且100-110可以有n個記錄,並且計數在字段中應該爲n。
你離開代碼示例中的'group by'部分 – 2017-08-10 13:24:44