一、我们来查看一个sbook的数据库
二、查看这个表的内容如下
三、表数据如下
四、代码如下
五、结果如下
*&---------------------------------------------------------------------* *& Report Z_TIANPAN_20190717_HELLO *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT z_tianpan_20190717_hello. DATA:counts TYPE i, total TYPE p DECIMALS 2, average TYPE f. DATA:connid LIKE sbook-connid. SELECT connid COUNT(*) SUM( luggweight ) AVG( luggweight ) INTO (connid,counts,total,average) FROM sbook GROUP BY connid. CHECK sy-subrc = 0. WRITE:/ 'SY-DBCNT=', sy-dbcnt , 'CONNID=', connid , 'COUNT=', counts , 'TOTAL=', total,'AVERAGE=', average. CHECK total > 10. WRITE: '总数大于10 . '. ENDSELECT. * 字符串拼接 WRITE: / '青青子衿' & '悠悠我心'. BREAK-POINT.