Способ 1. Устаревший
1 2 3 4 5 6 7 8 9 10 11 12 |
LOOP AT t_print_items. AT NEW posnr. SUM. t_print_itm-matnr = t_print_items-matnr. t_print_itm-vbeln = t_print_items-vbeln. t_print_itm-posnr = t_print_items-posnr. t_print_itm-quan_plan = t_print_items-quan_plan. t_print_itm-quan_fact = t_print_items-quan_fact. APPEND t_print_itm. ENDAT. ENDLOOP. |
Способ 2. Современный (7.40)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
LOOP AT t_print_item ASSIGNING FIELD-SYMBOL(<fs_test>) GROUP BY ( vbeln = <fs_test>-vbeln posnr = <fs_test>-posnr ) ASCENDING REFERENCE INTO DATA(route_group). DATA(members) = VALUE zswms_print_item_82_tt( ). LOOP AT GROUP route_group ASSIGNING FIELD-SYMBOL(<route>). members = VALUE #( BASE members ( <route> ) ). ENDLOOP. SORT members BY vbeln ASCENDING. CLEAR tt_record[]. LOOP AT members INTO DATA(mem). WRITE : / mem-pos , mem-vbeln, mem-posnr, mem-quan_plan, mem-quan_fact,mem-matnr_text, mem-meins. tt_record-posnr = mem-posnr. tt_record-vbeln = mem-vbeln. tt_record-matnr = mem-matnr. tt_record-quan_plan = mem-quan_plan. tt_record-quan_fact = mem-quan_fact. APPEND tt_record. ENDLOOP. |