首页 > 代码库 > 某种业务场景下,将一个工作区的多个字段整理到一个内表中
某种业务场景下,将一个工作区的多个字段整理到一个内表中
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: <lgty> TYPE any, 8 <t334t> 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 <t334t>.22 DO times TIMES.23 num = 10 + sy-index.24 UNASSIGN <lgty>.25 ASSIGN COMPONENT num OF STRUCTURE <t334t> TO <lgty>.26 ih_lgty-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.
工作区中的数据:
整理后,内表中的数据:
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。