SAP ERP material master data synchronization peripheral system

 Material master data integration is a relatively common requirement in many projects. Before implementing the system, we need to clarify the business process and scope of requirements involved, and clarify the business boundary of each system:

     If the data is pushed from SAP ERP to other systems , and the real-time requirements are high , I generally tend to capture the new, modified, or deleted data of the system in real time in the enhanced export to the peripheral system. Here, take the BTE enhancement of material master data, enhancement event 00001250 as an example:

Step 1: Transaction code FIBF

Step 2: Click Settings -> Products -> Customers

 The third step is to configure the corresponding relationship between events, products and functions. Click Settings -> Pub/Sub Module -> Client's

 ZSAMPLE_INTERFACE_00001250, you need to copy the standard function SAMPLE_INTERFACE_00001250 first

 Code example:

赋值
    "生成唯一标识
*    W_INPUT-GUID = CL_SYSTEM_UUID=>IF_SYSTEM_UUID_STATIC~CREATE_UUID_C22( ).
    TRY .
      CALL METHOD CL_SYSTEM_UUID=>IF_SYSTEM_UUID_STATIC~CREATE_UUID_C22
        RECEIVING UUID = w_input-guid.
    CATCH cx_uuid_error.
        "获取失败ID,根据YYMMDDHHMMSS+序号拼接
        w_input-guid = |{ sy-datum }{ sy-uzeit }{ 00001 }|.
    ENDTRY.

    READ TABLE t_makt_new INTO DATA(w_makt) WITH KEY spras = '1' .
    IF i_marc_new-werks = '8100'."新扩充8100视图数据
      w_input-matnr = i_mara_new-matnr."物料代码
      CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
        EXPORTING
          input  = w_input-MATNR
        IMPORTING
          output = w_input-MATNR.
      w_input-zwlms = i_mara_new-zwlms."物料长描述
      w_input-matkl = i_mara_new-matkl."物料组
      w_input-mtart = i_mara_new-mtart."物料分类
      w_input-meins = i_mara_new-meins."基本计量单位
      w_input-werks = i_marc_new-werks."工厂代码
      w_input-dispo = i_marc_new-dispo."MRP控制者
      w_input-maabc = i_marc_new-maabc."ABC标识
      w_input-fevor = i_marc_new-fevor."生成管理员
      w_input-sobsl = i_marc_new-sobsl."特殊采购类型-虚拟物料标识
      w_input-sbdkz = i_marc_new-SBDKZ."独立集中标识
      w_input-eisbe = i_marc_new-eisbe."安全库存标识
      w_input-plifz = i_marc_new-plifz."采购周期
      w_input-beskz = i_marc_new-beskz."采购类型              " BESKZ---   ADD BY HX_FHJ  20210106
      w_input-maktx  = w_makt-maktx.
      IF upd_marc IS INITIAL.
        w_input-action = upd_mara.
      ELSE.
        w_input-action = upd_marc.
      ENDIF.
      w_input-ERSDA = sy-DATUM.
      w_input-ERTIM = sy-UZEIT.
      w_input-ERNAM = sy-UNAME.

      IF w_input-maktx IS INITIAL.
        SELECT SINGLE maktx
          INTO @w_input-maktx
          FROM makt
          WHERE matnr = @i_mara_new-matnr
            AND spras = '1'.
      ENDIF.
      APPEND w_input TO input.
      CLEAR  w_input.
    ELSEIF ( upd_mara = 'U' AND i_marc_new-werks IS INITIAL ) OR w_makt-kz = 'U'."基本视图修改,需要判断是否存在工厂视图
      SELECT SINGLE werks,dispo,maabc,fevor,sobsl,maktx,sbdkz,eisbe,plifz,beskz   " BESKZ---   ADD BY HX_FHJ  20210106
        INTO @DATA(lw_marc)
        FROM marc INNER JOIN makt on marc~matnr = makt~matnr
        WHERE marc~matnr = @i_mara_new-matnr
          AND werks = '8100'
          AND spras = '1'.
      IF SY-SUBRC = 0.
        w_input-matnr = i_mara_new-matnr."物料代码
        CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
          EXPORTING
            input  = w_input-MATNR
          IMPORTING
            output = w_input-MATNR.
        w_input-mtart = i_mara_new-mtart."物料分类
        w_input-zwlms = i_mara_new-zwlms."物料长描述
        w_input-matkl = i_mara_new-matkl."物料组
        w_input-meins = i_mara_new-meins."基本计量单位
        w_input-werks = lw_marc-werks."工厂代码
        w_input-dispo = lw_marc-dispo."MRP控制者
        w_input-maabc = lw_marc-maabc."ABC标识
        w_input-fevor = lw_marc-fevor."生成管理员
        w_input-sobsl = lw_marc-sobsl."特殊采购类型-虚拟物料标识
        w_input-sbdkz = lw_marc-sbdkz."独立集中标识
        w_input-eisbe = lw_marc-eisbe."安全库存标识
        w_input-plifz = lw_marc-plifz."采购周期
        w_input-beskz = lw_marc-beskz."采购类型             " BESKZ---   ADD BY HX_FHJ  20210106

        IF w_makt-maktx IS NOT INITIAL.
           w_input-maktx  = w_makt-maktx.
        ELSE.
          w_input-maktx  = lw_marc-maktx.
        ENDIF.
        IF upd_marc IS INITIAL.
           w_input-action = 'U'.
        ELSEIF upd_mara IS NOT INITIAL.
          w_input-action = upd_marc.
        ENDIF.
        w_input-ERSDA = sy-DATUM.
        w_input-ERTIM = sy-UZEIT.
        w_input-ERNAM = sy-UNAME.
        APPEND w_input TO input.
        CLEAR  w_input.
      ENDIF.
    ENDIF.
    CLEAR w_makt.


"调用APS接口,推送物料主数据
  IF INPUT IS NOT INITIAL.
    CALL FUNCTION 'ZDD_APS_001'
      STARTING NEW TASK 'APS001' "防止接口连接时长影响SAP操作,采用这种方式调用接口
      EXPORTING
        INPUT         = INPUT
*       ARQ           =
              .
  ENDIF.

 You can search for BTE information on the Internet, here is a recommended article: BTEs – Business Transaction Events

Guess you like

Origin blog.csdn.net/Wang_Deji/article/details/130147466