REPORT ZCALCUATOR. TYPES:BEGIN OF TY_TEST, ID(3) TYPE C, DS(3) TYPE C, MENGE TYPE I, END OF TY_TEST. DATA:I_TEST TYPE TABLE OF TY_TEST, W_TEST TYPE TY_TEST. DATA:I_TEST2 TYPE TABLE OF TY_TEST. W_TEST-ID = '001'. W_TEST-MENGE = 10. W_TEST-DS = '123'. APPEND W_TEST TO I_TEST. W_TEST-ID = '001'. W_TEST-MENGE = 70. W_TEST-DS = '123'. APPEND W_TEST TO I_TEST. W_TEST-ID = '002'. W_TEST-MENGE = 20. W_TEST-DS = '1'. APPEND W_TEST TO I_TEST. W_TEST-ID = '002'. W_TEST-MENGE = 50. W_TEST-DS = '1'. APPEND W_TEST TO I_TEST. W_TEST-ID = '002'. W_TEST-MENGE = 80. W_TEST-DS = '3'. APPEND W_TEST TO I_TEST. W_TEST-ID = '003'. W_TEST-MENGE = 30. W_TEST-DS = '3'. APPEND W_TEST TO I_TEST. W_TEST-ID = '003'. W_TEST-MENGE = 90. W_TEST-DS = '13'. APPEND W_TEST TO I_TEST. LOOP AT I_TEST INTO W_TEST. COLLECT W_TEST INTO I_TEST2."关键一步。。。" CLEAR:W_TEST. ENDLOOP. WRITE:/ 'Collect前的内容:' . WRITE:/1(12) '编号' , '数量'. LOOP AT I_TEST INTO W_TEST. WRITE:/ W_TEST-ID, ' ',W_TEST-MENGE ,' ', W_TEST-DS. CLEAR:W_TEST. ENDLOOP. WRITE:/ . WRITE:/ 'Collect后的结果:' . WRITE:/1(12) '编号' , '数量'. LOOP AT I_TEST2 INTO W_TEST. WRITE:/ W_TEST-ID , ' ',W_TEST-MENGE. CLEAR:W_TEST. ENDLOOP.
来源:https://www.cnblogs.com/tailiang/p/11750603.html