Sapass

 Simplify SAP R/3 development with Excel VBA/VB RFC  
Home> Bapi>GoodsMovement



Index

GoodsMovement

GoodsMovement


The business object Goods movement is a physical or logical
movement of materials which leads to a change in material stock levels or results in direct consumption of the material.


Structure
A goods movement can be a goods receipt, goods issue, or a transfer posting of materials.


A goods movement consists of items containing the quantity and value of
the given material. The materials to be actually placed in or removed from storage can be specified in each item as single units.


Integration
A transfer posting can be carried out within a plant and between different plants.


The quantity specified in the item leads to a change in stock in the
plant, plant storage area, and storage bin. Goods movements for direct consumption do not affect stock levels.


An item in a goods receipt does not necessarily indicate the receipt of
material, because an item can also represent the reversal of the original goods movement.


For valuated stock, the transaction figure is updated on the relevant material stock account.


11-Dec-2005


Methods

Available Methods


  • Cancel : Reverse goods movement [ BAPI_GOODSMVT_CANCEL ]
  • CreateFromData : Post goods movement [ BAPI_GOODSMVT_CREATE ]
  • GetDetail : Display details of goods movement [ BAPI_GOODSMVT_GETDETAIL ]
  • GetItems : Display detailed list of material documents [ BAPI_GOODSMVT_GETITEMS ]

11-Dec-2005


Cancel

Cancel


Using the Cancel method, material documents can be cancelled by callingup the function module MB_CANCEL_GOODS_MOVEMENT. You can only cancelone material document each time you call up the transaction. You shouldnote that the system does not delete the original document, but creates a new material document (reversal document).


Notes

The following authorization object is checked when this method is used:

  • M_MSEG_WMB Material documents: plant
  • M_MSEG_BMB Material documents: movement type
  • Transfer

    The key fields for the material document, MATERIALDOCUMENT and MATDOCUMENTYEAR have to be transferred to the method as import
    parameters.

    The posting date with the field GOODSMVT_PSTNG_DATE und the user name with the field GOODSMVT_PR_UNAME are also imported.

    In table GOODSMVT_MATDOCITEM, you have the option of transferring thematerial document items that are to be cancelled. If no items are transferred, all the items in the material document are cancelled.

    Confirmations

    Once the system has successfully cancelled a material document, itreturns the material document number and material document year key fields in the GOODSMVT_HEADRET parameter to the initiator.

    Messages are returned in the parameter return. The parameter
    documentation shows the return codes and their meanings.

    Further Information

    The method can only carry out your function if no error messages weregenerated in the "Return" table. This is the case if the header data and all the items were processed successfully.


    Transaction control is not implemented. The calling program thereforehas to execute the 'Commit Work' itself after this method has beensuccessfully invoked (i.e. if no errors were reported in the Return parameter).


    11-Dec-2005


    CreateFromData

    CreateFromData


    You can use this method to create a material document for a goods movement.

    You can only create one material document each time you call up the method.

    You can use a simulation function before posting the goods movement tocheck how the data is updated in the database. The standard system is
    configured so that the goods movement is posted immediately without simulating beforehand.

    Notes

    The following authorization object is checked when this method is used:

  • M_MSEG_WMB Material documents: plant
  • M_MSEG_BMB Material documents: movement type

  • M_MSEG_WWA Goods movements: plant
  • M_MSEG_BWA Goods movements: movement type
  • Transfer

    The following information about the material document that is to be created is transferred to the method:


  • a structure with header data
  • a structure with the code for the movement
  • a table with the item data
  • a table with the serial numbers
  • The posting is carried out in the R/3 System via the MB_CREATE_GOODS_MOVEMENT function module.


    Confirmations

    Messages are returned in the parameter return. The parameterdocumentation shows the return codes and their meanings.

    Further Information

    The method can only carry out your function if no error messages were
    generated in the "Return" table. This is the case if the header data and all the items were processed successfully.

    Transaction control is not implemented. The calling program thereforehas to execute the 'Commit Work' itself after this method has been
    successfully invoked (i.e. if no errors were reported in the Return parameter).

    Which fields have to be filled during the various transactions/ events?

    The following sample scenarios demonstrate which fields have to be filled for which business transactions/events (code).


    There are the following types of transactions/events:

    1. GM_Code 01: Goods receipt for purchase order
    2. GM_Code 02: Goods receipt for production order
    3. GM_Code 03: Goods issue
    4. GM_Code 04: Transfer posting
    5. GM_Code 05: Other goods receipts

    6. GM_Code 06: Reversal of goods movements

    Entering the movement indicator

    Depending on the transaction, you must enter the following in the movement indicator:

  • GM_Code 01 (Goods receipt for purchase order): B

  • GM_Code 02 (Goods receipt for production order): F
  • For all other transactions, you leave the field blank.
  • For 1: GM_Code 01: Goods receipt for purchase order

  • Purchase order known
  • The following fields have to be filled:


  • Purchase order
  • Purchase order item
  • Movement type
  • Movement indicator
  • Quantity in unit of entry

  • ISO code unit of measurement for unit of entry or
    quantity proposal
  • The following fields may have to be filled in some cases (incomplete listing):

  • Shelf life expiration date (if it has been configured like this in the system)

  • Reason for movement (if it has been configured like this in the system)
  • Batch (if the material is handled in batches and batch numbers are not assigned automatically)
  • Storage location (if a storage location has not been specified in the purchase order item)

  • The following fields can be filled (incomplete listing):

  • Stock type
  • Item text
  • Unloading point
  • Delivery completed indicator

  • You cannot fill the following fields (incomplete listing):

  • Account assignment fields (account assignment is adopted from the purchase order)
  • Reservation
  • Receiving/issuing material

  • Receiving/issuing plant
  • Receiving/issuing storage location
  • In the case of a purchase order item with the "subcontracting" itemcategory, only the GR item in the interface is to be transferred. The system automatically determines GI items.


  • Purchase order unknown: shipping notification known
  • The following fields must be filled:

  • Delivery
  • Delivery item
  • Movement type
  • Other fields, such as those under "Purchase order known". The system
    determines the relevant purchase order item via the delivery/delivery item.

  • Purchase order known: purchase order should be created automatically
  • The following fields must be filled:

  • Material number
  • Plant

  • Storage location
  • vendor
  • Movement type
  • Movement indicator
  • quantity in unit of entry
  • ISO code unit of measurement for unit of entry

  • The following fields may have to be filled in some cases (incomplete listing):

  • Shelf life expiration date (if it has been configured like this in the system)
  • Reason for movement (if it has been configured like this in the system)

  • Batch (if the material is handled in batches and batches are not assigned automatically)
  • The following fields can be filled (incomplete listing):

  • Stock type
  • Item text

  • Unloading point
  • You cannot fill the following fields (incomplete listing):

  • Account assignment fields (automatic creation of purchase order items with account assignment is not supported)

  • Reservation
  • Receiving/issuing material
  • Receiving/issuing plant
  • Receiving/issuing storage location
  • Purchase order unknown: a purchase order should not be created

  • The following fields must be filled:

  • Material number
  • Plant
  • Storage location
  • Vendor
  • Movement type

  • Movement indicator
  • Quantity in unit of entry
  • ISO code unit of measurement for unit of entry
  • The following fields may have to be filled in some cases (incomplete listing):


  • Shelf life expiration date (if it has been configured like this)
  • Reason for movement (if it has been configured like this)
  • Batch (if the material is handled in batches and automatic assignment of batch numbers is not set)

  • The following fields can be filled (incomplete listing):

  • Special stock indicator
  • Item text
  • Unloading point
  • Goods recipient

  • The following fields cannot be filled (incomplete listing):

  • Account assignment (automatic creation of purchase order items with account assignment is not supported)
  • Reservation
  • Receiving/issuing material

  • Receiving/issuing plant
  • Receiving/issuing storage location
  • Receiving/issuing batch
  • The input combinations listed above for the GM_CODE 01 can be combinedwithin an input table so that they can be posted in a material document. Items can also be posted for different purchase orders,
    provided that all the purchase orders reference the same vendor.

    For 2 GM_Code 02: Goods receipt for production order

    The following fields must be filled:

  • Order
  • Movement type

  • Movement indicator
  • Quantity in unit of entry
  • ISO code unit of measurement for unit of entry or
    quantity proposal
  • The following fields may have to be filled in some cases (incomplete listing):


  • Shelf life expiration date (if the system has been configured like this)
  • Reason for movement (if the system has been configured like this)
  • Batch (if the material is handled in batches and automatic batch number assignment is set)

  • Storage location (if storage location has not been specified)
  • The following fields can be filled (incomplete listing):

  • Order item (co-product)
  • Stock type

  • Item text
  • Unloading point
  • "Delivery completed" indicator
  • The following fields cannot be filled (incomplete listing):

  • Account assignment fields (the account assignments are adopted from the purchase order

  • Reservation
  • Receiving/issuing material
  • Receiving/issuing plant
  • Receiving/issuing storage location
  • Receiving/issuing batch

  • For 3 GM_Code 03: Goods issue

  • Goods issue without reference to a reservation
  • The following fields must be filled:

  • Material number
  • Plant
  • Storage location

  • Movement type
  • Movement indicator
  • Quantity in unit of entry
  • ISO code unit of measurement for unit of entry
  • The following fields may have to be filled in some cases (incomplete listing):


  • Special stock (e.g. sales order, project, vendor etc.)
  • Shelf life expiration date (if the system is configured like this)
  • Reason for movement (if the system has been configured like this)

  • Batch (if the material is handled in batches and automatic batch number assignment is set)
  • Account assignment fields
  • The following fields can be filled (incomplete listing):

  • Special stock indicator

  • Item text
  • Unloading point
  • Goods recipient
  • The following fields cannot be filled (incomplete listing):

  • Reservation
  • Receiving/issuing material

  • Receiving/issuing plant
  • Receiving/issuing storage location
  • Receiving/issuing batch
  • Goods issue with reference to a reservation
  • The following fields must be filled:


  • Reservation number
  • Reservation item
  • Record type of the reservation
  • Movement indicator
  • Quantity in unit of entry

  • ISO code unit of measurement for unit of entry
  • The following fields may have to be filled in some cases (incomplete list):

  • Shelf life expiration date (if this has been configured in the system)

  • Reason for movement (if this has been configured in the system)
  • Batch (if the material is handled in batches and automatic batch number assignment is not set)
  • Storage location (if not planned in the reservation)

  • The following fields can be filled (incomplete count):

  • Special stock indicator
  • Item text
  • Unloading point
  • Goods recipient

  • The following fields cannot be filled (incomplete count):

  • Movement type
  • Material
  • Plant
  • Account assignment fields
  • For 4 GM_Code 04: Transfer posting


  • Transfer posting without reference to a reservation
  • The following fields must be filled:

  • Material number
  • Plant
  • Storage location
  • Movement type

  • Movement indicator
  • Quantity in unit of entry
  • ISO code unit of measurement for unit of entry
  • The following fields may have to be filled in some cases (incomplete listing):


  • Receiving material
  • Receiving plant
  • Receiving storage location
  • Receiving batch (if material is handled in batches and you want to change batches)

  • Receiving/issuing special stock (e.g. sales order, project, vendor etc.)
  • Shelf life expiration date (if this has been configured in the system)
  • Reason for movement (if this has been configured in the system)

  • Batch (if the material is handled in batches and automatic batch number assignment is not set)
  • The following fields can be filled (incomplete listing):

  • Special stock indicator
  • Item text

  • Account assignment fields (for automatic posting lines: Expense/income from stock transfer)
  • The following fields cannot be filled (incomplete listing):

  • Reservation
  • Transfer posting with reference to a reservation

  • See goods issue with reference to a reservation

    For 5 GM_Code 05: Other goods receipts

  • Other goods receipt with reference to a reservation
  • See goods issue without reference to a reservation

  • Other goods receipt with reference to a reservation

  • See goods issue with reference to a reservation

    For 6 GM_Code 06: Reversal of goods movements

    You can use the Cancel method to reverse goods movements. But you mayalso want to cancel a goods movement without referencing a material document (see the Cancel method).


    If you want to work without referencing the document, you have to fillthe field BAPI_GM_ITEM_CREATE-XSTOB in the interface. In this case, thesystem converts the movement type assigned in the interface to thereversal movement type. Alternatively you can set the reversal movement
    type in the interface. In this case, the BAPI_GM_ITEM_CREATE_XSTOB field must be transferred blank.

    If you want to cancel a goods movement with reference to a reservation(without using the Cancel method) you can only transfer the field BAPI_GM_ITEM_CREATE_XSTOB if it is filled. Movement types are not
    transferred when you post with reference to a reservation, as the movement type is contained in the reservation item.


    11-Dec-2005


    GetDetail

    GetDetail


    The GetDetail method enables you to read a whole document (header anditems) using the material document's key fields. The document is not blocked during this procedure.

    Notes

    The following authorization object is checked when this method is used:


  • M_MSEG_WMB Material documents: plant
  • M_MSEG_BMB Material documents: movement type
  • Transfer

    The key fields of the material document (MATERIALDOCUMENT and MATDOCUMENTYEAR) have to be transferred to the method as import
    parameters.

    Confirmations

    In the GOODSMVT_HEADER parameter, the initiator receives the header information for the document chosen.

    In the GOODSMVT_ITEMS table, the initiator receives data for each item in the material document chosen.


    Messages are returned in the parameter return. The parameterdocumentation shows the return codes and their meanings.

    Further Information

    The method can only carry out your function if no error messages weregenerated in the "Return" table. This is the case if the header data and all the items were processed successfully.


    Transaction control is not implemented. The calling program thereforehas to execute the 'Commit Work' itself after this method has beensuccessfully invoked (i.e. if no errors were reported in the Return parameter).


    11-Dec-2005


    GetItems

    GetItems


    The GetItems method allows you to read the header and item data of all material documents that meet the selection criteria below:

    Notes

    The following authorization object is checked when this method is used:

  • M_MSEG_WMB Material documents: plant

  • M_MSEG_BMB Material documents: movement type
  • Transfer

    You can use the following criteria to select the material documents:

  • Material (structure MATERIAL_RA)
  • Plant (structure PLANT_RA)

  • Storage location (structure STGE_LOC_RA)
  • Batch (structure BATCH_RA)
  • Movement type (structure MOVE_TYPE_RA)
  • Special stock indicator (structure SPEC_STOCK_RA)
  • Transaction/event type (structure TR_EV_TYPE_RA)

  • Posting date (structure PSTNG_DATE_RA)
  • Vendor (structure VENDOR_RA)
  • User name (structure USERNAME_RA)
  • Confirmations

    The GOODSMVT_HEADER table contains the header data for the material
    documents chosen and the GOODSMVT_ITEMS table contains the item data for the material documents chosen.

    Messages are returned in the parameter return. The parameterdocumentation shows the return codes and their meanings.

    Further Information


    The method can only carry out your function if no error messages weregenerated in the "Return" table. This is the case if the header data and all the items were processed successfully.

    Transaction control is not implemented. The calling program therefore
    has to execute the 'Commit Work' itself after this method has beensuccessfully invoked (i.e. if no errors were reported in the Return parameter).


    11-Dec-2005