SAP Good Movement IDoc (MBGMCR03) : Structure and BAPI

SAP Good Movement BAPI e1499236283415

SAP Good Movement IDoc: SAP MM-IM package offers two standard IDocs to exchange Material Document and to replicate creation, modification and cancellation of a SAP Good Movement.

You will find the two SAP Good Movement IDocs to manage MD and BAPIs related to these IDocs.

The main IDocs for Good Movement are:

  • MBGMCR03: SAP Good Movement IDoc for Posting?Good Mvt
  • MBGMCA01: SAP Reverse Good Mvt IDoc

SAP Good Movement IDoc?MBGMCR03

The standard IDoc MBGMCR03?is used for posting of Goods Movement. It based on standard BAPI MB_CREATE_GOODS_MOVEMENT.

SAP Posting IDoc MBGMCR03 Structure

You find following the structure of this Idocs :

SAP Good Movement IDoc MBGMCR03

  • E1MBGMCR Header Segment
    • E1BP2017_GM_HEAD_01 BAPI Communication Structure: Material Document Header Data
    • E1BP2017_GM_CODE MMIM: New Key Assignment GM_CODE to Transaction of Inv. Mgmt
    • /SPE/E1BP2017_GM_REF_EWM BAPI Communication Structure: Material Document EWM Ref.
    • E1BP2017_GM_ITEM_CREATE BAPI Communication Structure: Create Material Document Item
      • E1BP2017_GM_ITEM_CREATE1 BAPI Communication Structure: Create Material Document Item
    • E1BP2017_GM_SERIALNUMBER BAPI Communication Structure: Create Mat. Doc., Serial No.
    • /SPE/E1BP2017_SERVICEPART_D BAPI Communication Structure: Service Parts Data
    • E1BPPAREX Ref. Structure for BAPI Parameter EXTESIONIN/EXTENSIONOUT

SAP Good Movement Related BAPI

ALE_GOODSMVT_CREATE

The BAPI ALE_GOODSMVT_CREATE will generate an IDoc with Good Movement ( a Material Document ).

CALL FUNCTION 'ALE_GOODSMVT_CREATE'
  EXPORTING
    goodsmvtheader =            " bapi2017_gm_head_01
    goodsmvtcode =              " bapi2017_gm_code
*   testrun = SPACE             " bapi2017_gm_gen-testrun
*   goodsmvtrefewm =            " /spe/bapi2017_gm_ref_ewm
*   obj_type = 'BUS2017'        " serial-obj_type
*   serial_id = '0'             " serial-chnum
  TABLES
    goodsmvtitem =              " bapi2017_gm_item_create
*   goodsmvtserialnumber =      " bapi2017_gm_serialnumber
*   goodsmvtservpartdata =      " /spe/bapi2017_servicepart_data
*   extensionin =               " bapiparex
    receivers =                 " bdi_logsys
*   communication_documents =   " swotobjid
*   application_objects =       " swotobjid
  EXCEPTIONS
    ERROR_CREATING_IDOCS = 1    "

BAPI_GOODSMVT_CREATE

In order to integrate a MBGMCR03 idocs, you can use the standard BAPI?IDOC_INPUT_MBGMCR.

The BAPI will format the MBGMCR IDoc into BAPI format and call the Standard BAPI?BAPI_GOODSMVT_CREATE.

CALL FUNCTION 'BAPI_GOODSMVT_CREATE
  EXPORTING
    goodsmvt_header =           " bapi2017_gm_head_01  Material Document Header Data
    goodsmvt_code =             " bapi2017_gm_code  Assign Code to Transaction for Goods Movement
*   testrun = SPACE             " bapi2017_gm_gen-testrun  Simulate Goods Movement
*   goodsmvt_ref_ewm =          " /spe/bapi2017_gm_ref_ewm  BAPI Communication Structure: Material Document EWM Ref.
  IMPORTING
    goodsmvt_headret =          " bapi2017_gm_head_ret  Material Document Number/Material Document Year
    materialdocument =          " bapi2017_gm_head_ret-mat_doc  Number of Material Document
    matdocumentyear =           " bapi2017_gm_head_ret-doc_year  Material Document Year
  TABLES
    goodsmvt_item =             " bapi2017_gm_item_create  Material Document Items
*   goodsmvt_serialnumber =     " bapi2017_gm_serialnumber  Serial Number
    return =                    " bapiret2      Return Messages
*   extensionin =               " bapiparex     Parameters EXTENSIONIN/EXTENSIONOUT

Check also?List of important SAP Good Movement BAPI (Create,Cancel & Getdetails)


SAP Good Movement IDoc MBGMCA01

The standard IDoc MBGMCA01 is used for?Reverse goods movements. It based also on standard BAPI MB_CANCEL_GOODS_MOVEMENT.

Reverse Good Movement IDoc MBGMCA01 Structure

The structure for IDoc MBGMCA01 is:

SAP Good Movement IDoc MBGMCA01

  • E1MBGMCA Header Segment
    • E1BP2017_GM_ITEM_04 BAPI Communication Structure: Cancel Mat. Doc., Items

BAPIs Related to SAP Reverse Good Mvt IDoc MBGMCA01

ALE_GOODSMVT_CANCEL

The Bapi?ALE_GOODSMVT_CANCEL can generated an reverse goods movement IDocs.
Check this post SAP Good Movement BAPIs for more detail about this BAPI.

CALL FUNCTION 'ALE_GOODSMVT_CANCEL'
  EXPORTING
    materialdocument =          " bapi2017_gm_head_02-mat_doc  Number of a Material Document
    matdocumentyear =           " bapi2017_gm_head_02-doc_year  Material Document Year

IDOC_INPUT_MBGMCA

In order to integrate a MBGMCA01 idocs, you can use the standard BAPI?IDOC_INPUT_MBGMCA.

The BAPI will format the MBGMCA IDoc into BAPI format and call the Standard BAPI?BAPI_GOODSMVT_CANCEL.

CALL FUNCTION 'IDOC_INPUT_MBGMCA' 
  EXPORTING
    input_method =              " bdwfap_par-inputmethd
    mass_processing =           " bdwfap_par-mass_proc
  IMPORTING
    workflow_result =           " bdwf_param-result
    application_variable =      " bdwf_param-appl_var
    in_update_task =            " bdwfap_par-updatetask
    call_transaction_done =     " bdwfap_par-calltrans
  TABLES
    idoc_contrl =               " edidc
    idoc_data =                 " edidd
    idoc_status =               " bdidocstat
    return_variables =          " bdwfretvar
    serialization_info =        " bdi_ser
  EXCEPTIONS
    WRONG_FUNCTION_CALLED = 1   "