I have internal table lt_stock
with following rows:
WERKS
LGORT
MATNR
QUANTITY
I want to group WERKS LGORT and MATNR and add the QUANTITY.
I have done this using 2 loops:
LOOP AT lt_stock INTO ls_stock.
MOVE-CORRESPONDING ls_stock TO ls_stock_key.
CONCATENATE ls_stock-werks ls_stock-lgort ls_stock-matnr INTO ls_stock_key-key.
APPEND ls_stock_key TO lt_stock_key.
ENDLOOP.
LOOP AT lt_stock_key INTO ls_stock_key.
AT END OF key.
SUM.
APPEND ls_stock_key TO lt_stock_calculated.
ENDAT.
ENDLOOP.
Is it possible to do this using a single LOOP?
(Example: AT END OF werks, lgort, matnr
)