Code: Alles auswählen.
FORM itab_check.
SORT itab BY vtref blnr.
LOOP AT itab.
AT NEW vtref.
CLEAR lf_merkblnr.
lf_merkblnr = itab-blnr .
CLEAR counter.
REFRESH wa_itab.
ENDAT.
IF itab-blnr(12) EQ lf_merkblnr(12).
counter = counter + 1.
APPEND itab TO wa_itab.
ENDIF.
AT END OF vtref.
IF counter LT 20.
DELETE itab WHERE vtref = itab-vtref.
ENDIF.
ENDAT.
ENDLOOP.
ENDFORM.
Code: Alles auswählen.
SORT itab BY xblnr gpart vtref.
LOOP AT itab.
AT NEW vtref.
CLEAR counter.
CLEAR lf_merkblnr.
lf_merkblnr = itab-xblnr.
wa_gpart = itab-gpart.
wa_vtref = itab-vtref.
endat.
IF itab-blnr(12) EQ lf_merkblnr.
counter = counter + 1.
ENDIF.
AT END OF vtref.
IF counter LT count.
DELETE itab WHERE vtref = wa_vtref AND blnr(12) = lf_merkblnr
AND gpart = wa_gpart.
ENDIF.
ENDAT.
ENDLOOP.