need logic in loop
I need a logic in internal table loop.
vbeln matnr werks quantity
1234 AAAA 0001 10.000
2345 AAAA 0001 20.000
2345 BBBB 0001 30.000
3456 AAAA 0001 35.000
I need a logic that for every new Material i need to know how many records are there in internal table for that material.
sort itab ascending by matnr.
loop at itab.
at new matnr.
i need no: of records for that matnr ( AAAA) i.e. 3..
i am confused where to use this at new...
can anyone provide the best logic in terns of performance?