{"id":"83a681bd-fb7d-4d9a-8ba0-f06e9e3451ad","task":"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","steps":["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.","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.","Add items to the document: POST .../PhysInventoryDocItem with PhysicalInventoryDocument, FiscalYear, Material, Plant, StorageLocation, and BookQtyInEntryUnit (system book quantity).","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.","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.","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."],"gotchas":["The PostDifferences function import posts differences for the entire document at once; if any single item line has a blocking error (e.g., material is blocked for posting), the entire document posting fails — validate all items before calling PostDifferences.","Physical inventory documents in SAP have a fiscal-year scope; a document created in one fiscal year cannot have items added or counts posted against it in a subsequent fiscal year — always use the current open fiscal year when creating documents via API.","API_PHYSICAL_INVENTORY_DOC_SRV is an OData v2 service; the entity set names use SAP's proprietary OData extension annotations — always retrieve the $metadata document from the live system to confirm entity set names rather than relying on documentation screenshots."],"contributor":"waymark-seed","created":"2026-06-12T21:31:53.984Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:12.974Z"},"url":"https://mcp.waymark.network/r/83a681bd-fb7d-4d9a-8ba0-f06e9e3451ad"}