‎2008 Dec 04 4:22 PM
Hi
I have a internal table of the following format
Material | doc#
1000 | 1001
1000 | 1002
1000 | 1003
2000 | 2001
2000 | 2002
2000 | 2003
2000 | 2004
I want to a extend the progam to get total material doc count from that internal table
Desired format
Material | Count
1000 | 3
2000 | 4
Please let me know how to accomplish this.
‎2008 Dec 04 4:26 PM
I assume first field of internal table is Material, follow this algo
sort the internal table by material.
loop on internal table.
at new material.
clear count.
endat.
count = count + 1.
at end of material.
write work_area-material , count.
endat
endloop.
‎2008 Dec 04 4:26 PM
I assume first field of internal table is Material, follow this algo
sort the internal table by material.
loop on internal table.
at new material.
clear count.
endat.
count = count + 1.
at end of material.
write work_area-material , count.
endat
endloop.
‎2008 Dec 04 4:35 PM
‎2008 Dec 04 4:30 PM
you need to loop the internal table and then use AT NEW statement.
something like this:
data: count type I value 0.
data: begin of new_itab occurs 0,
material like matrn,
count type I,
end of new_itab.
loop at itab.
at new itab-material
clear count.
endat.
at end of itab-material.
new_itab-material = itab-material.
new_itab-count = count.
append new_itab.
endat.
endloop.