Create a physical inventory document and post inventory differences via the SAP S/4HANA OData API (API_PHYSICAL_INVENTORY_DOC_SRV)

domain: api.sap.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Fetch the X-CSRF-Token via GET /sap/opu/odata/sap/API_PHYSICAL_INVENTORY_DOC_SRV/?sap-client=100 with header 'X-CSRF-Token: Fetch'; store the returned token and session cookie.
  2. Create the physical inventory document: POST .../PhysInventoryDocHeader with a JSON body containing FiscalYear, Plant, StorageLocation, and PhysInventoryDocDesc; the response returns the PhysicalInventoryDocument and FiscalYear key.
  3. Add items to the document: POST .../PhysInventoryDocItem with PhysicalInventoryDocument, FiscalYear, Material, Plant, StorageLocation, and BookQtyInEntryUnit (system book quantity).
  4. Enter count results by sending PATCH to the item entity with QuantityInEntryUnit set to the physical count value and IsQuantityConfirmed = true; this marks the count as entered.
  5. Post inventory differences by calling the PostDifferences function import: POST .../PostDifferences with PhysicalInventoryDocument and FiscalYear in the body — this triggers material document creation for all lines with a variance between book and counted quantity.
  6. Verify the posted material document number returned in the function import response and check it in SAP transaction MI07 (Post Inventory Differences) for audit compliance.

Known gotchas

Related routes

Create a sales order in SAP S/4HANA via OData API
SAP S/4HANA Cloud OData · 5 steps · unrated
Read production order status and confirm a goods receipt for a production order in SAP S/4HANA using the OData v2 API (API_PRODUCTION_ORDER_2_SRV)
api.sap.com · 6 steps · unrated
Create and update a Job Requisition and Candidate record via the SAP SuccessFactors Recruiting Management (RCM) OData API
help.sap.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans