Skip to Content

Message M8321 Document contains same order item more than once

Hello!

We use purchase orders for intercompany deliveries from one warehouse to another.

To these purchase order deliveries are made based on which intercompany invoices are created and booked using IDOC's. In all our settings GR-Bsd.IV is set for the purchase orders including the intercompany.

During a period of time several delieveries are made and invoiced in one collect invoice. Because order picking etcetera does take some time it can occor that a goods receipt is booked to a product which was partially in back order at the time the first delivery note has been created. Therefore a new separate delivery is created for one and the same purchase order line. In case these are invoiced together the Error Message M8321 occurs.

This is incorrect, because based on the fact there are two separate deliveries booked with separate Material documents. The system should be able to match the invoices lines with the proper goods receipt. This is a functionality which is missing. In the standard transaction MIRO it is possible to match the invoice lines based on the goods receipt. So this should be possible within the IDOC as well.

We are not using charges, it doesn't concern main products.

It is a straight forward booking of invoices to purchase orders.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 22 at 05:24 AM

    This is standard limitation. During the EDI processing via message type INVOIC, the FM IDOC_INPUT_INVOIC_MRM cannot identify the reference numbers (EKBE-LFGJA, EKBE-LFBNR and EKBE-LFPOS). It neither knows the goods receipt document number (EKBE-LFBNR) nor the goods receipt document item number (EKBE-LFPOS). It were designed to provide the possibility for vendors to sent the invoice to the customer, that's why it behaves differently with MIRO.

    The PO number and item are passed via segment E1EDP02 qualifier 001.

    BELNR = purchase order number (EBELN)
    ZEILE = purchase order item (EBELP)

    The delivery note number is passed via the segment E1EDP02 qualifier 016.
    BELNR = delivery note number (LFSNR or EKBE-XBLNR)

    The mapping is implemented in MRM_E1EDP02_PROCESS (LMRMHF15).

    So the program identifies the corresponding goods receipt item based on the delivery note number (EKBE-XBLNR) and if available the purchase order (EKBE-EBELN) and item number (EKBE-EBELP). The logic is implemented in MRM_GR_ASSIGN (LMRMHF0Q). The program tries to setup the invoice document item information based on the provided data automatically.

    In case there is more than one segment for the same purchase order item the error message "Document contains same order item more than once (M8321)" is issued.

    The current design cannot handle this situation and stops the processing in order to avoid the creation of an invoice document with incorrect data. As workaround, there are two possibilities to enable the successful processing of this business scenario:

    A) You could aggregate the IDoc data which refer to the same delivery note number and PO item in user-exit EXIT_SAPLMRMH_011. Afterwards the program creates for each goods receipt item (LFGJA, LFBNR, LFPOS) one invoice item following the SAP standard design form MRM_GR_DISTRIBUTE (LMRMHF1G). So that the program is able to invoice all open goods receipts items for same delivery note or PO item. FYI, you can have a look at SAP KBA 2177340 and 2165016.

    B) You could use the new message type INCINV_CREATE which is available as of EHP5.
    The message type INCINV_CREATE calls BAPI BAPI_INCOMINGINVOICE_CREATE1 and provides similar functionality as MIRO.
    So when the outbound/inbound IDoc is created with using the message type INCINV_CREATE the reference goods receipt document information could be filled in addition to the purchase order item.

    Hope this could be of help.

    Add comment
    10|10000 characters needed characters exceeded