当一个内表有很多数据,并且每一类又有多条数据,而我们只要处理其中每一类中的一条数据,取得的这一条数据要有排序的。
比如取每个到货单号(xblnr) 的 第一次收货时间(budat)
1: 用 xblnr budat 进行排序(ascending)
然后 用 delete adjacent duplicates from itab comparing xblnr
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
sort itab descending by xblnr budat.
delete adjacent duplicates from itab comparing xblnr.
2: 在内表循环中用 at new xblnr,at end of xblnr 处理。把每一个xblnr 中最小的日期拿出来即可
data m type d.
loop at itab into ss.
at new xblnr .
m= '99999999'.
endat.
if ss-budat < m.
m = ss-budat.
endif.
at end of t.
ss2-t = ss-xblnr.
ss2-d = m.
append ss2 to itab2.
endat.
endloop.