UP TO X ROWS 一般用在取限制记录数。这种用法在取多条数据的针对某一字段特别有用。如下:
取最近成本估算。
DATA:it_keko LIKE keko OCCURS 0 WITH HEADER LINE.
CLEAR:xkeko,zco_sub_com,zco_sub_com[].
SELECT * INTO TABLE it_keko FROM keko UP TO 1 ROWS
WHERE werks = werks AND
matnr = matnr AND
klvar = 'ZPC1' AND
loekz <> 'X' AND
kadat <= kadky AND
bidat >= kadky
AND tvers = '01'
AND bwvar = '001' AND keko~mandt = sy-mandt
ORDER BY kadky DESCENDING .
阅读(2843) | 评论(1) | 转发(0) |