一、BAPI进行MIGO过账新增字段
BAPI新增收货行号字段,保存外围系统的数据
二、MATDOC表新增收货行号
三、MSEG表新增收货行号
创建DDL视图用于扩展NSDM_E_MSEG
四、BADI:MB_BAPI_GOODSMVT_CREATE
调用方法IF_EX_MB_BAPI_GOODSMVT_CREATE~EXTENSIONIN_TO_MATDOC
METHOD IF_EX_MB_BAPI_GOODSMVT_CREATE~EXTENSIONIN_TO_MATDOC. DATA: c_lenstruc TYPE i VALUE 30, wa_bapi_mb_header TYPE bapi_te_xmkpf, wa_bapi_mb_item TYPE bapi_te_xmseg, wa_extension_in TYPE bapiparex. FIELD-SYMBOLS: <fs_imseg> TYPE imseg. CHECK NOT extension_in[] IS INITIAL. * Analyze IMSEG for document structure and assign LINE_IDs if necessary CALL METHOD cl_mmim_line_id_manager=>analyze_mb_create CHANGING ct_imseg = ct_imseg[] EXCEPTIONS duplicate_line_id = 1 OTHERS = 2. LOOP AT extension_in INTO wa_extension_in. CASE wa_extension_in-structure. * extension of MKPF WHEN 'BAPI_TE_XMKPF'. MOVE wa_extension_in+c_lenstruc TO wa_bapi_mb_header. MOVE-CORRESPONDING wa_bapi_mb_header TO cs_imkpf. * extension of MSEG WHEN 'BAPI_TE_XMSEG'. MOVE wa_extension_in+c_lenstruc TO wa_bapi_mb_item. READ TABLE ct_imseg WITH KEY line_id = wa_bapi_mb_item-matdoc_itm ASSIGNING <fs_imseg>. IF sy-subrc EQ 0. MOVE-CORRESPONDING wa_bapi_mb_item TO <fs_imseg>. ENDIF. ENDCASE. ENDLOOP. ENDMETHOD.
五、BAPI传值
DATA:ls_imseg TYPE bapi_te_xmseg. ...... CLEAR:ls_imseg. ls_imseg-matdoc_itm = l_line_id. ls_imseg-zline = lwa_pcsx-zline. CLEAR:ls_exte. ls_exte-structure = 'BAPI_TE_XMSEG'. ls_exte-valuepart1 = ls_imseg. APPEND ls_exte TO lt_exte. ...... CALL FUNCTION 'BAPI_GOODSMVT_CREATE' EXPORTING goodsmvt_header = lwa_header goodsmvt_code = lwa_code * TESTRUN = ' ' * GOODSMVT_REF_EWM = * GOODSMVT_PRINT_CTRL = IMPORTING * GOODSMVT_HEADRET = materialdocument = l_doc matdocumentyear = l_year TABLES goodsmvt_item = lt_item extensionin = lt_exte return = lt_return.