The Purchase Requisition OData API is provided to the end user in order to consume the functionality of an SAP S/4 HANA system for integration scenarios.
The OData API can be consumed by configuring the relevant Communication Arrangement and is supported for communication scenario: Purchase Requisition Integration (SAP_COM_0102)
Please refer the blog post for setting up a communication arrangement.
I would like to cover the below create and read operations for Purchase Requisition and its associated entities using ODATA API, in this blog post to ease the life of developers.
Reading a Purchase Requisition
The Purchase Requisition has the following embedded entity setup –
Note: – As per the entity structure it is clear that Account assignment, delivery address and Notes data cannot be accessed without an Item reference. Similarly, Purchase Requisition Item data cannot be reference without Purchase Requisition header reference.
Thus, reading a Purchase Requisition can depend on what all data the end user seeks w.r.t the requisition in system. A user can read one or more entity data based on the request URL. For example –
You can create a new Requisition in Simulation mode when you don’t want the data to be posted but only validated for any errors and/warnings. End user can use ‘PurReqnDoOnlyValidation’ flag in Purchase Requisition header as ‘true‘ in POST request.
The API supports creating a new requisition with one or more items, as well as adding items in existing purchase requisition (bulk create). We can add a new item in a Purchase Requisition (Minimum data set) as follows –
Points to note: 1.While posting an item, post it along with its associated entities else your request shall fail. 2.You can send a batch of create items (one changeset deals with single Purchase Requisition, for multiple requisitions, use multiple changesets)
Item Account Assignment and Delivery Address Create request for accounting and delivery address shall fail as these are dependent for Purchase requisition item (entities with dependency on Item data).
Purchase Requisition Item Text In context of Purchase requisition only Item notes are supported. A requisition does not have any header level note.
Read an Item Text (Note)
You can fetch an Item text(note) in various ways, refer to sample URLs below.