1 DATA:num TYPE i. 2 CONSTANTS: times TYPE i VALUE 29. 3 DATA: BEGIN OF ih_lgty, 4 lgty TYPE lgtyp, 5 END OF ih_lgty, 6 it_lgty LIKE TABLE OF ih_lgty. 7 FIELD-SYMBOLS:TYPE any, 8 LIKE t334t. 9 10 DATA:lh_t334t LIKE t334t,11 lt_t334t LIKE TABLE OF t334t.12 13 SELECT SINGLE14 *15 INTO lh_t334t16 FROM t334t17 WHERE lgnum = 'NJ1'18 AND kzear = 'A'19 AND lgtkz = 'BC1'.20 *** 将一个工作区的数据整理到一个内表中21 ASSIGN lh_t334t TO .22 DO times TIMES.23 num = 10 + sy-index.24 UNASSIGN .25 ASSIGN COMPONENT num OF STRUCTURE TO .26 ih_lgty-lgty = .27 APPEND ih_lgty TO it_lgty.28 ENDDO.29 DELETE it_lgty WHERE lgty IS INITIAL.30 ***31 SORT it_lgty.32 DELETE ADJACENT DUPLICATES FROM it_lgty COMPARING ALL FIELDS.33 num = lines( it_lgty ).34 WRITE:num.
工作区中的数据:
整理后,内表中的数据: