Using COLLECT for Aggregation
Task
Aggregate quantities by material number using the COLLECT statement.
Write Your ABAP Code
Loading...
📥 Sample Input & Output
A100 10 A100 5 A200 7 Output: A100 15 A200 7
💡 Hint
COLLECT automatically sums numeric fields with identical keys.
✅ View Reference Solution
LOOP AT it_sales INTO DATA(ls_sale). COLLECT ls_sale INTO it_sales. ENDLOOP.