2018年12月19日星期三

BAPI_GOODSMVT_CREATE(ADD CUSTOMER FIELD )

HEADER: ADD Customer Fields to structure of  IMKPF and BAPI_TE_XMKPF.
Items:  ADD Customer Fields to structure of  IMSEG and BAPI_TE_XMSEG.

Implements the Badi:

Line 417 of Function BAPI_GOODSMVT_CREATE .

    TRY.

        call badi lo_mb_bapi_goodsmvt_create->extensionin_to_matdoc
          EXPORTING
            EXTENSION_IN EXTENSIONIN[]
          CHANGING
            CS_IMKPF     S_IMKPF
            CT_IMSEG     T_IMSEG[]
            CT_RETURN    return.
      CATCH cx_badi_initial_reference.                  "#EC NO_HANDLER

    ENDTRY.



METHOD IF_EX_MB_BAPI_GOODSMVT_CREATE~EXTENSIONIN_TO_MATDOC.

  DATA:
    c_lenstruc          TYPE 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.



没有评论:

发表评论

Customer Characteristic

  Characteristic Descriptions are stored in the table - CABNT - Language - SPRAS - Characteristic description - ATBEZ Characteristic Values ...