abap中取内表中每一类中的一行的方法
?當(dāng)一個(gè)內(nèi)表有很多數(shù)據(jù),并且每一類又有多條數(shù)據(jù),而我們只要處理其中每一類中的一條數(shù)據(jù),取得的這一條數(shù)據(jù)要有排序的。
?
比如取每個(gè)到貨單號(hào)(xblnr)??的?第一次收貨時(shí)間(budat)
1:?用?xblnr budat?進(jìn)行排序(ascending)
然后?用?delete adjacent duplicates from itab comparing xblnr
?
sort itab descending by xblnr budat.
?delete adjacent duplicates from itab comparing xblnr.
?
?
?
2:?在內(nèi)表循環(huán)中用?at new xblnr,at end of xblnr?處理。把每一個(gè)xblnr?中最小的日期拿出來(lái)即可
?
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.
?
總結(jié)
以上是生活随笔為你收集整理的abap中取内表中每一类中的一行的方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 根据当前时间如何找到上月的第一天和最后一
- 下一篇: abap 取数排序之后怎么取第一行