sap-Abap DELETE - duplicates

本文深入探讨了ABAP中DELETE-duplicates语句的工作原理及其限制。该语句仅能删除内表中相邻且相同的数据行,除非指定特定字段进行比较。作者通过实际案例分享了这一特性带来的挑战,并提醒开发者注意其使用条件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天发现自已一直忽视了一个问题, 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

wxgnolux

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值