需求说明:订单系统显示页面新增批量打印功能
增强点:CL_COIS_DISP_LIST_NAVIGATION -->TOOLBAR方法中新增隐式增强添加自定义打印按钮
增强点:BADI-->WORKORDER_INFOSYSTEM新增增强实施
实现位置:IF_EX_WORKORDER_INFOSYSTEM~AT_OUTPUT_SCREEN_LAY
METHOD if_ex_workorder_infosystem~at_output_screen_lay.DATA lv_space TYPE char10.DATA lt_ioheader TYPE STANDARD TABLE OF ioheader WITH DEFAULT KEY.DATA lt_iooper TYPE STANDARD TABLE OF iooper WITH DEFAULT KEY.DATA lt_prd_data TYPE STANDARD TABLE OF ioheader WITH DEFAULT KEY.DATA lt_coois_prdlist TYPE STANDARD TABLE OF zspp_coois_prdlist WITH DEFAULT KEY.DATA lo_logger TYPE REF TO if_salv_logger.DATA lv_worktime(16) TYPE p DECIMALS 1.DATA(lo_salv) = NEW cl_salv_gui_grid_facade( o_grid = io_alv_grid o_logger = lo_logger ).FIELD-SYMBOLS:<ft_data> TYPE table.IF cv_ucomm EQ 'BPRINT' AND iv_after_ucomm EQ 'X'." IMPORT lt_ioheader = lt_ioheader FROM MEMORY ID 'COOIS_ALV_OUTPUT'."IMPORT ioheader_tab = lt_ioheader FROM MEMORY ID 'IOA05'.DATA(lt_data) = lo_salv->if_salv_gui_grid_data_source~get_r_appl_data( ).ASSIGN lt_data->* TO <ft_data>.MOVE-CORRESPONDING <ft_data> TO lt_ioheader.io_alv_grid->get_selected_rows( IMPORTING et_index_rows = DATA(lt_index_rows) et_row_no = DATA(lt_row_no) ).DESCRIBE TABLE lt_index_rows LINES DATA(lv_lines).IF lv_lines EQ 0.MESSAGE '请至少选择一条需要打印的订单'(001) TYPE 'S' DISPLAY LIKE 'E'.ELSE.LOOP AT lt_index_rows INTO DATA(ls_row)..READ TABLE lt_ioheader INTO DATA(ls_ioheader) INDEX ls_row-index.IF sy-subrc EQ 0.APPEND ls_ioheader TO lt_prd_data.ENDIF.CLEAR ls_ioheader.ENDLOOP.SELECT DISTINCT afko~aufnr,afvc~steus, afpo~matnr,afko~gamng, afko~gmein,afvc~vornr, afvc~ltxa1,crhd~arbpl,afvv~vgw01,afvv~vge01,aufk~zzfitter,CASE afvc~steusWHEN 'ZN04' THEN afvc~ltxa1ELSE makt~maktxEND AS maktxFROM afko AS afkoINNER JOIN afpo AS afpo ON afko~aufnr = afpo~aufnrINNER JOIN @lt_prd_data AS prd ON afko~aufnr = prd~aufnrLEFT JOIN aufk AS aufk ON afko~aufnr = aufk~aufnrLEFT JOIN makt AS makt ON afpo~matnr = makt~matnr AND spras = @sy-languLEFT JOIN afvc AS afvc ON afko~aufpl = afvc~aufplLEFT JOIN afvv AS afvv ON afvc~aufpl = afvv~aufpl AND afvc~aplzl = afvv~aplzlLEFT JOIN crhd AS crhd ON afvc~arbid = crhd~objid AND crhd~objty = 'A'INTO CORRESPONDING FIELDS OF TABLE @lt_coois_prdlist.LOOP AT lt_coois_prdlist ASSIGNING FIELD-SYMBOL(<fs_prd>).lv_worktime = <fs_prd>-vgw01.<fs_prd>-matnr = COND #( WHEN <fs_prd>-steus EQ 'ZN04' THEN '' ELSE <fs_prd>-matnr ).<fs_prd>-printdate = |{ sy-datum DATE = ISO }|.<fs_prd>-quantity = |{ <fs_prd>-gamng } { <fs_prd>-gmein }|.<fs_prd>-worktime = |{ lv_worktime } { <fs_prd>-vge01 }|.<fs_prd>-vornr_int = <fs_prd>-vornr.<fs_prd>-vornr = <fs_prd>-vornr_int.CLEAR lv_worktime.ENDLOOP.SORT lt_coois_prdlist BY aufnr vornr_int.CALL FUNCTION 'ZPP_COOIS_BATCHPRINT'EXPORTINGit_prdinf = lt_coois_prdlist.ENDIF." ENDIF.ENDIF.
报表显示修改在 IF_EX_WORKORDER_INFOSYSTEM~TABLES_MODIFY_LAYTABLES_MODIFY_LAY方法中实现