Notice: S/4HANA Cloud Community content and profiles will be moving to the SAP Community in February 2021. If you do not want your profile migrated you will need to delete your profile from the S/4HANA Cloud Community by January 22nd 2021. Check out the Migration Blog and FAQ for more information.
with your approved SAP customer or partner ID (S-User) to get access to all content. Please go to the About page to find out how to get an S-User.
with your approved SAP partner ID (S-User) or SAP User ID to get access to all content. Please go to the About page to find out how to get an S-User.
Continuing with our episode 1, here in this Blog post I would like to cover the update and delete operations for Purchase Requisition and its associated entities.
Updating a Purchase Requisition
As per the available/exposed fields in Purchase Requisition header only ‘PurchaseReqnDescription’ can be updated in header. This operation is supported with HTTP PATCH or batch of updates. A sample batch would look like –
Points to note: – 1. Fields such as LastChangedDateTime, CreationDate, CreatedBy, PurReqCreationDate, DeliveryAddressID, ManualDeliveryAddressID, PurchasingDocumentCategory, PurchasingDocumentSubtype are read only fields and patch to these fields shall be ignored without raising any error. 2. Patching fields like PurReqnReleaseStatus shall not guarantee expected behavior of PR and follow on document(s), as such fields are manipulated by system and should not be modified manually 3. Date related fields shall take (date + UTC) timestamp in milliseconds. 4. DELETE operation is not supported. However, PR item can be marked for deletion using PATCH operation sending IsDeleted as ‘X’(true). 5. If IsDeleted is marked ‘X’, patch for that items shall fail with appropriate error message (item marked for deletion cannot be changed, until undeleted).
Updating Account Assignment, Delivery Address and Item Text
All the three entities can be updated by the user via batch or non-Batch call. Account assignment can be modified from unknown account assignment (U) to a single/Multiple account assignment via a Batch call, since the data is dependent on Item entity.
While changing account assignment from U(Unknown) to K (Single/Multiple): 1. Send update (PATCH) for ‘AccountAssignmentCategory’ 2. Send update (PATCH) for ‘MultipleAcctAssgmtDistribution’ : (‘ ’ – Single Accounting, 1 – Distribution by Quantity, 2 – Distribution by percentage) 3. Send create (POST) for A_PurReqnAcctAssgmt [in batch]*
While changing form account assignment K(Single/Multiple) to U (Unknown) : 1. Send update (PATCH) for ‘AccountAssignmentCategory’ 2. Send update (PATCH) for ‘MultipleAcctAssgmtDistribution’ setting it to blank value
While updating Account assignment make sure your Item Quantity is completely covered by your Accounting lines else it might generate an error.
POST for associated entities is restricted in order to prevent business data inconsistency and support logical operations for the document.
DELETE operation for A_PurReqnAcctAssgmt and A_PurReqAddDelivery entities is not supported by the API since they are dependent on Item data.
DELETE operation for A_PurchaseReqnItemText shall delete the item note for a PR item.
Reference addresses are not supported for ODATA API, only supported address types are Default Address from Plant and Manual address.
* – POST is only enabled for A_PurReqnAcctAssgmt in batch mode in order to support logical changes in accounting for Purchase Requisitions