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
- 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.
- 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:
-
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.
-
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)
- 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.
- 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.
- 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:
- For GR-based items: Each GRN can be referenced separately with unique delivery note numbers.
- For freight/planned delivery costs: Consolidate into single line items regardless of multiple GRNs.
- Ensure unique delivery note values for each goods receipt to enable proper matching.
Payload Structure Adjustment
- For GR-based items: Reference each GRN separately with unique identifiers.
- For non-GR-based items: Consolidate freight/planned delivery costs into single line items.
- 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
SAP Knowledge Base Article - Public