首页 > 其他 > 详细

某种业务场景下,将一个工作区的多个字段整理到一个内表中

时间:2014-08-18 10:34:03      阅读:339      评论:0      收藏:0      [点我收藏+]
 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 SINGLE
14   *
15   INTO  lh_t334t
16   FROM t334t
17   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.

工作区中的数据:

bubuko.com,布布扣

整理后,内表中的数据:

bubuko.com,布布扣

某种业务场景下,将一个工作区的多个字段整理到一个内表中,布布扣,bubuko.com

某种业务场景下,将一个工作区的多个字段整理到一个内表中

原文:http://www.cnblogs.com/ruingy/p/3918767.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!