Skip to Content
Product Information
Author's profile photo Surbhi Bansal

Purchase Requisition ODATA API – Episode 1

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 –

  • Header data

    • Item data

      • Account Assignment
      • Delivery Address
      • Notes

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 –

Read only Purchase Requisition Header https:// myXXXXXX-api. API_PURCHASEREQ_PROCESS_SRV/A_PurchaseRequisitionHeader(‘10005263’) (GET)

Read Purchase Requisition Header along with item
https:// myXXXXXX-api. API_PURCHASEREQ_PROCESS_SRV/A_PurchaseRequisitionHeader(‘10005263’)?$expand=to_PurchaseReqnItem (GET)

Read Purchase Requisition Header along with item(s), account assignment, Delivery Address and Notes https:// myXXXXXX-api. API_PURCHASEREQ_PROCESS_SRV/A_PurchaseRequisitionHeader(‘10005263’)?$expand=to_PurchaseReqnItem,to_PurchaseReqnItem/to_PurchaseReqnAcctAssgmt,to_PurchaseReqnItem/to_PurchaseReqnDeliveryAddress,to_PurchaseReqnItem/to_PurchaseReqnItemText (GET)

Creating a Purchase Requisition

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.

https:// myXXXXXX-api. API_PURCHASEREQ_PROCESS_SRV/A_PurchaseRequisitionHeader (POST)

Sample request payload :
“PurReqnDescription”:”Test PR

Points to note:
1. Your requisition will be created in Logon language, else it shall generate an error.
2. You can trigger creation of multiple Requisitions in batch using multiple changesets.

Reading a Purchase Requisition Item

Follow the sample URLs to fetch Purchase Requisition Item details along with its associated entities.

Read for a single Purchase Requisition Item https:// myXXXXXX-api. API_PURCHASEREQ_PROCESS_SRV/A_PurchaseRequisitionItem(PurchaseRequisition=’10005263′, PurchaseRequisitionItem=’10’) (GET)

Read for a single Purchase Requisition Item with its associated entities https:// myXXXXXX-api. API_PURCHASEREQ_PROCESS_SRV/A_PurchaseRequisitionItem(PurchaseRequisition=’10005263′, PurchaseRequisitionItem=’10’)?$expand=to_PurchaseReqnAcctAssgmt,to_PurchaseReqnDeliveryAddress,to_PurchaseReqnItemText (GET)

Creating a Purchase Requisition Item

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 –

“BaseUnit “: “P “,
“PurchaseRequisitionPrice “: “10”,
“PurchasingGroup”: “PGrp1”
“Plant”: “1010”
“CompanyCode”: “1010”,
“to_PurchaseReqnAcctAssgmt”: {
“to_PurchaseReqnDeliveryAddress”: {
“to_PurchaseReqnItemText”: {

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.

You can fetch Notes for all Items in PR as follows https:// myXXXXXX-api.$filter=PurchaseRequisition eq ‘4000084870’ (GET)

You can fetch all notes for an item in PR as follows https:// myXXXXXX-api.$filter=PurchaseRequisition eq ‘4000084870’ and PurchaseRequisitionItem eq ’10’ (GET)

You can fetch an item note for a PR as follows https:// myXXXXXX-api. API_PURCHASEREQ_PROCESS_SRV/A_PurchaseReqnItemText(PurchaseRequisition=’4000084870′,PurchaseRequisitionItem=’10’,DocumentText=’B02′,TechnicalObjectType=’EBAN’,Language=’EN’) (GET)

Create an Item Text (Note)

https:// myXXXXXX-api. (POST)
“PurchaseRequisition”: “4000084870”,
“PurchaseRequisitionItem”: “10”,
“DocumentText”: “B02”,
“NoteDescription”: “note2”

Let us know your comments and/or suggestions with regards to Purchase Requisition in SAP S/4 HANA Cloud and OData APIs.

Please follow the next blog for details regarding Edit & delete on Purchase Requisition and its entities.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Sai Giridhar Kasturi
      Sai Giridhar Kasturi

      Thanks for sharing

      Author's profile photo Anup Nair
      Anup Nair

      Very well explained, Thank you!

      Author's profile photo Prasobh Prakash
      Prasobh Prakash

      Thanks for sharing.

      Author's profile photo Srinivas Rao
      Srinivas Rao

      Hi Surbhi - This API is called from Ariba Guided buying for creating PR. Here, we are facing issue with a field called "Service Performer" which is at the item level. Did you get any such value while you were creating PR and how did you go around resolving it?


      Thanks & Regards

      Srinivas Rao.

      Author's profile photo R B
      R B



       am created a s4 hana cloud trial account and also got the P-ID. when trying to login in uisng the url and giving the Puser and password it is not acception

      s4 login

      But with the same id and password i can see the tiles in the below link