今天发现自已一直忽视了一个问题, DELETE - duplicates 删除内表重复记录语句是有条件限制的,必需是依据关键字或你定义的字段排序后才行。
仔细看了一下它的文档,确实是它只能对相邻的相同的记录做删除。因为这个忽视,找了n久都没找到程序的 bug 在哪,潜意识里不会想到 DELETE - duplicates 会是这样的定义,范了最低级的错误,学习不够严谨,下不违例。
DELETE - duplicates Syntax ... ADJACENT DUPLICATES FROM itab [COMPARING { comp1 comp2 ...}|{ALL FIELDS}]... . Addition: ... COMPARING {comp1 comp2 ...}|{ALL FIELDS}
Effect With these additions, the statement DELETE deletes all lines in certain groups of lines, except for the first line of the group. These are groups of lines that follow one another and have the same content in certain components. If the addition COMPARING is not specified, the groups are determined by the content of the key fields.
Lines are considered to be doubled if the content of neighboring lines is the same in the components examine