MIGO行项目屏幕增强
一、增强描述
-
由于在事务码MIGO中存在的字段中没有能够满足客户需求的字段,所以需要在事务码MIGO的屏幕中添加一个新的页签用来保存物料凭证中行项目增加的字段。
-
通过查找BADI的程序ZDEMO_BADI,输入参数MIGO后,得到对应BADI为MB_MIGO_BADI。
二、增强步骤
-
创建增强数据表和增强结构
-
创建增强数据存储表。
-
创建增强数据结构
-
创建增强数据表类型结构。
-
-
创建增强屏幕
-
新建Function Group,定义全局变量。
-
创建函数ZMM_I_GET_DATA(行项目:从屏幕获取数据)
-
创建函数ZMM_I_SET_DATA(行项目:输出数据到屏幕)
-
创建函数ZMM_UPDATE_DATA(抬头/行项目:更新数据到数据库 )
-
创建函数ZMM_SET_GOACTION(抬头/行项目:设置屏幕Action Code)
-
-
创建行项目子屏幕9000
-
创建屏幕9000.
-
创建屏幕字段根据自建表的增强字段命名。
-
给屏幕创建PBO事件。
-
-
创建BADI实施
-
使用事务码SE19创建BADI实施,最后一步建立空类。
-
新增实施类属性
-
IF_EX_MB_MIGO_BADI~INIT
METHOD if_ex_mb_migo_badi~init.APPEND gf_class_id TO ct_init. ENDMETHOD.
-
IF_EX_MB_MIGO_BADI~PBO_DETAIL
METHOD if_ex_mb_migo_badi~pbo_detail.IF gf_class_id = i_class_id.DATA: wa_item TYPE zsmm_migo01.CHECK i_line_id IS NOT INITIAL.e_cprog = 'SAPLZMM_MIGO01'(001). "'SAPL + 'FG Name'e_dynnr = '9000'.e_heading = 'Item Addition1'.g_line_id = i_line_id.READ TABLE it_item INTO wa_item WITH KEY line_id = i_line_id.CALL FUNCTION 'ZMM_I_SET_DATA'EXPORTINGi_input = wa_item.ENDIF.ENDMETHOD.
-
IF_EX_MB_MIGO_BADI~PAI_DETAIL
METHOD if_ex_mb_migo_badi~pai_detail.DATA: wa_item_new TYPE zsmm_migo01,wa_item_old TYPE zsmm_migo01.CHECK i_line_id <> 0.CALL FUNCTION 'ZMM_I_GET_DATA'IMPORTINGe_output = wa_item_new.READ TABLE it_item INTO wa_item_old WITH KEY line_id = i_line_id.IF wa_item_new <> wa_item_old.e_force_change = 'X'.ENDIF.ENDMETHOD.
-
IF_EX_MB_MIGO_BADI~LINE_MODIFY
METHOD if_ex_mb_migo_badi~line_modify.DATA: wa_item_new TYPE zsmm_migo01,wa_item_old TYPE zsmm_migo01,wa_ztmm_migo01 TYPE ztmm_migo01,l_subrc TYPE sy-subrc.READ TABLE it_item INTO wa_item_old WITH KEY line_id = i_line_id.l_subrc = sy-subrc.IF sy-subrc <> 0.IF cs_goitem-mblnr IS NOT INITIALAND cs_goitem-mjahr IS NOT INITIALAND cs_goitem-zeile IS NOT INITIAL.SELECT SINGLE * FROM ztmm_migo01INTO wa_ztmm_migo01WHERE mblnr = cs_goitem-mblnrAND mjahr = cs_goitem-mjahrAND zeile = cs_goitem-zeile.IF wa_ztmm_migo01 IS NOT INITIAL.MOVE-CORRESPONDING wa_ztmm_migo01 TO wa_item_new.ENDIF.ENDIF.wa_item_new-line_id = i_line_id.INSERT wa_item_new INTO TABLE it_item.ELSE.CHECK g_line_id = i_line_id.CALL FUNCTION 'ZMM_I_GET_DATA'IMPORTINGe_output = wa_item_new.MODIFY it_item FROM wa_item_new TRANSPORTING ztest01 ztest02 WHERE line_id = i_line_id.ENDIF.ENDMETHOD.
-
IF_EX_MB_MIGO_BADI~LINE_DELETE
METHOD if_ex_mb_migo_badi~line_delete.DELETE it_item WHERE line_id = i_line_id. ENDMETHOD.
-
IF_EX_MB_MIGO_BADI~RESET
CLEAR: it_item,g_no_input,g_cancel,g_line_id.
-
IF_EX_MB_MIGO_BADI~POST_DOCUMENT
METHOD if_ex_mb_migo_badi~post_document.DATA: wa_ztmm_migo01 TYPE ztmm_migo01,lt_ztmm_migo01 TYPE TABLE OF ztmm_migo01,wa_item TYPE zsmm_migo01,wa_mseg TYPE mseg.IF it_item IS NOT INITIAL.LOOP AT it_item INTO wa_item.IF g_cancel IS INITIAL.READ TABLE it_mseg INTO wa_msegWITH KEY line_id = wa_item-line_id.ELSE.READ TABLE it_mseg INTO wa_msegWITH KEY smbln = wa_item-mblnrsmblp = wa_item-zeilesjahr = wa_item-mjahr.ENDIF.IF sy-subrc IS INITIAL.MOVE-CORRESPONDING wa_item TO wa_ztmm_migo01.MOVE-CORRESPONDING wa_mseg TO wa_ztmm_migo01.APPEND wa_ztmm_migo01 TO lt_ztmm_migo01.ENDIF.ENDLOOP.CALL FUNCTION 'ZMM_UPDATE_DATA' IN UPDATE TASKTABLESit_item = lt_ztmm_migo01.ENDIF.ENDMETHOD.
-
IF_EX_MB_MIGO_BADI~MODE_SET
METHOD if_ex_mb_migo_badi~mode_set." i_action:" A01 = Goods receipt" A02 = Return delivery" A03 = Cancellation" A04 = Display" A05 = Release GR bl.st." A06 = Subsequent deliv." A07 = Goods issue"" i_refdoc:" R01 = Purchase order" R02 = Material document" R03 = Delivery note" R04 = Inbound delivery" R05 = Outbound delivery" R06 = Transport" R07 = Transport ID code" R08 = Order" R09 = Reservation" R10 = Other GR *------------------------------------------------*IF i_action = 'A03' OR i_action = 'A04' .g_no_input = abap_true.ENDIF.IF i_action = 'A03'.g_cancel = abap_true.ENDIF.CALL FUNCTION 'ZMM_SET_GOACTION'EXPORTINGi_goaction = i_action.ENDMETHOD.
-
-
验证效果