SAP Knowledge Base Article - Public

3686615 - Error "document contains same order item more than once" when posting supplier invoices via standard API in SAP S/4HANA Cloud Public Edition

Symptom

  • When posting supplier invoices through the Standard API Supplier Invoice Integration (SAP_COM_0057), the system raises error message M8321 - "Document contains same order item more than once" when referencing multiple goods receipts (GRNs) against the same purchase order item with identical conditions.
  • Additional error messages may include:
    • "Goods receipt item [GRN number] is invalid"

Environment

SAP S/4 HANA Cloud Public Edition

Reproducing the Issue

  1. Post supplier invoices through the Standard API Supplier Invoice Integration (SAP_COM_0057) referencing multiple GRNs against the same purchase order item with identical conditions.
  2. Observe the error messages: "Document contains same order item more than once" and "Goods receipt item [GRN number] is invalid."

Cause

The error occurs due to the following reasons:

  1. Duplicate Freight/Planned Delivery Cost Items: The invoice payload contains multiple items with identical planned delivery cost conditions (freight) for the same purchase order item.

  2. Invalid Reference Field Usage: Fields like ReferenceDocument, ReferenceDocumentItem, and ReferenceDocumentFiscalYear are incorrectly used for planned delivery cost items, which are not subject to goods receipt-based invoice verification.

Resolution

1. For API Integration (SAP_COM_0057)

  1. Consolidate Freight Items:
    • Combine all planned delivery cost/freight items for the same PO item into a single invoice item within the API payload.
    • Remove duplicate condition steps that reference the same purchase order item.
    • SAP standard API does not allow duplicate freight condition items within one invoice document.
  2. Correct Reference Field Usage:
    • Do not use ReferenceDocument, ReferenceDocumentItem, and ReferenceDocumentFiscalYear fields for planned delivery cost items.
    • These fields are only applicable for goods receipt-based invoice verification scenarios.
  3. Fix Fiscal Year Values:
    • Replace any fiscal year values set to "0000" with valid fiscal year values or leave it blank.
    • Ensure all fiscal year references in the payload correspond to actual fiscal periods.

2. For GR-Based Invoice Verification

When multiple goods receipts exist against the same purchase order item:

  1. For GR-based items: Each GRN can be referenced separately with unique delivery note numbers.
  2. For freight/planned delivery costs: Consolidate into single line items regardless of multiple GRNs.
  3. Ensure unique delivery note values for each goods receipt to enable proper matching.

Payload Structure Adjustment

  1. For GR-based items: Reference each GRN separately with unique identifiers.
  2. For non-GR-based items: Consolidate freight/planned delivery costs into single line items.
  3. Avoid duplicate references: Ensure no duplicate purchase order item references with identical conditions.

 

Keywords

supplier invoice, standard api, sap_com_0057, document contains same order item more than once, goods receipt item invalid, planned delivery cost, freight consolidation, fiscal year invalid, sap s/4hana cloud public edition, invoice verification , KBA , MM-FIO-IV-2CL , Fiori UI for Invoice Verification (Public Cloud) , Problem

Product

SAP S/4HANA Cloud Public Edition all versions