在ABAP开发中, 我们经常会删除内表中的重复行,这时我们会需要一个很方便的语句,就是"DELETE ADJACENT DUPLICATES FROM", 但是在使用这个语句,要注意它删除相邻的重复行,我们一般要通过SORT 对这个语句进行排序,示例如下:

DATA: BEGIN OF wa_pa0001,

pernr LIKE pa0001-pernr,

uname LIKE pa0001-uname,

bukrs LIKE pa0001-bukrs,

plans LIKE pa0001-plans,

END OF wa_pa0001.

DATA: itab_pa0001 LIKE TABLE OF wa_pa0001 WITH HEADER LINE.

SORT itab_pa0001 BY pernr.

DELETE ADJACENT DUPLICATES FROM itab_pa0001.

posted on 2008-12-18 09:39  沧海-重庆  阅读(3331)  评论(2编辑  收藏  举报