可以使用ABAP提供的集合函数取代ABAP代码来获得最大或最小值。

不建议使用:

Maxnu = 0.

Select * from zflight where airln = ‘LF’ and cntry = ‘IN’.

  Check zflight-fligh > maxnu.

  Maxnu = zflight-fligh.

Endselect.

建议使用:

Select max( fligh ) from zflight into maxnu where airln = ‘LF’ and cntry = ‘IN’.

其它可用集合函数还有 min (最小值), avg (平均值), sum (求和) and count (数据选择的行数).

posted on 2009-08-03 19:25  levin  阅读(596)  评论(0编辑  收藏  举报