# at new...endat.

plz help me to implement the following code.its not working.

LOOP AT ITAB_OUTTAB INTO WA_OUTTAB.

MOVE:WA_OUTTAB-BISMT TO WA_CONSUMPTION-BISMT.

AT NEW WERKS.

MOVE WA_OUTTAB-WERKS TO WA_CONSUMPTION-WERKS.

AT NEW MATNR.

MOVE WA_OUTTAB-MATNR TO WA_CONSUMPTION-MATNR.

IF WA_OUTTAB-SHKZG = 'H'.

QUANTITY_H = WA_OUTTAB-MENGE.

QUANTITY_H_SUM = QUANTITY_H_SUM + QUANTITY_H.

ELSE.

QUANTITY_S = WA_OUTTAB-MENGE.

QUANTITY_S_SUM = QUANTITY_S_SUM + QUANTITY_S.

ENDIF.

QUANTITY_NET = QUANTITY_S_SUM - QUANTITY_H_SUM.

MOVE QUANTITY_H_SUM TO WA_CONSUMPTION-QUANTITY_H_SUM.

MOVE QUANTITY_S_SUM TO WA_CONSUMPTION-QUANTITY_S_SUM.

MOVE QUANTITY_NET TO WA_CONSUMPTION-QUANTITY_NET.

APPEND WA_CONSUMPTION TO FINAL_CONSUMPTION.

CLEAR WA_CONSUMPTION.

ENDAT.

ENDAT.

ENDLOOP.