SAP Knowledge Base Article - Public

2825462 - Reference Document field not accepted via API

Symptom

You are posting goods receipts via API_MATERIAL_DOCUMENT_SRV. You want to pass the supplier's order number information and use the header 'Reference Document' field. 
The posting fails with error 'Field ReferenceDocument cannot be set for this operation on header level' (MM_IM_ODATA_API_MDOC/001)

Environment

SAP S/4HANA Cloud

Reproducing the Issue

  1. Post a Goods Receipt via API_MATERIAL_DOCUMENT_SRV.
  2. In the header of the payload pass a value in the field "ReferenceDocument".
  3. Posting fails with error 'Field ReferenceDocument cannot be set for this operation on header level'  

Cause

The 'Reference Document' field was not a supported field within the API, up to and including Cloud version CE2002.
This field is made available in CE2005.

Resolution

Until the delivery of CE2005, as an alternative, you could pass such external reference values via the 'MaterialDocumentHeaderText' field.

Note: the following fields are also not yet supported in the Header Level:

'CreatedByUser'
'CreationDate'
'CreationTime'
'MaterialDocument'
'MaterialDocumentYear'
'InventoryTransactionType'

the following fields are also not yet supported in the Item Level:

'MaterialDocument'
'MaterialDocumentYear'
'MaterialDocumentItem'
'InventoryStockType'
'ControllingArea'
'FiscalYear'
'FiscalYearPeriod'
'FiscalYearVariant'
'IssuingOrReceivingStockType'
'IssgOrRcvgSpclStockInd'
'GoodsMovementIsCancelled'
'QuantityInBaseUnit'
'MaterialBaseUnit'
'CompanyCodeCurrency'
'IsAutomaticallyCreated'
'ReversedMaterialDocumentYear'
'ReversedMaterialDocument'
'ReversedMaterialDocumentItem'
'SlsPrcAmtInclVATInCoCodeCrcy'
'SpecialStockIdfgWBSElement'
'InventoryValuationType'
'AccountAssignmentCategory'
'FunctionalArea'
'HierarchyNodeLevel'

See Also

API Create Material Document  : here it lists the fields which are relevant for the Create or Post.

Keywords

API_MATERIAL_DOCUMENT_SRV, CL_API_MATERIAL_DOCUME_DPC_EXT, LS_HEADER_FORBIDDEN, forbidden field, MM_IM_ODATA_API_MDOC001, SE24, check_forbidden_item_fields. API_MATERIAL_DOCUMENT_SRV/resource/A_MaterialDocumentHeader' , KBA , MM-IM-GF-BAPI , BAPIs for Goods Movements , Problem

Product

SAP S/4HANA Cloud 2002