Continuing with our blog series for Purchase Requisition ODATA API, here in this Blog post I would like to cover the create, read, update and delete operations for Purchase Requisition Item notes.

Reading Item Notes

There are multiple ways to read item notes as mentioned below:

Read item note of a particular note type: 

You can get the item note of a particular note type in a purchase requisition item as follows -

https://<host>/sap/opu/odata/SAP/API_PURCHASEREQ_PROCESS_SRV/A_PurchaseReqnItemText(PurchaseRequisition='12345678',  PurchaseRequisitionItem='10',DocumentText='B01',TechnicalObjectType='EBAN',Language='EN') (GET)

Read item notes of all items or a particular item in a purchase requisition:

You can get the item notes of all items or a particular item in a purchase requisition as follows -

https://<host>/sap/opu/odata/SAP/ API_PURCHASEREQ_PROCESS_SRV/ A_PurchaseReqnItemText?$filter=PurchaseRequisition eq '12345678' and PurchaseRequisitionItem eq '00010' (GET)

Point to note:

It is mandatory to provide the purchase requisition number, "PurchaseRequisition", as filter parameter in the request. You may also provide the item number, "PurchaseRequisitionItem", as filter parameter, if required.

Read notes of a particular item:  

You can get all the notes of a particular item in a purchase requisition as follows -

https://<host>/sap/opu/odata/SAP/API_PURCHASEREQ_PROCESS_SRV/A_PurchaseRequisitionItem(PurchaseRequisition='12345678', PurchaseRequisitionItem='00010')/to_PurchaseReqnItemText (GET)

Read all item notes of a PR Item along with the item details:  

You can get all the item notes along with item details of a particular item in a purchase requisition as follows -

https://<host>/sap/opu/odata/SAP/API_PURCHASEREQ_PROCESS_SRV/A_PurchaseRequisitionItem(PurchaseRequisition='12345678', PurchaseRequisitionItem='00010')?$expand=to_PurchaseReqnItemText (GET)

Creating Item Notes

You can create an item note of a particular note type in a purchase requisition item as follows -

https://<host>/sap/opu/odata/SAP/API_PURCHASEREQ_PROCESS_SRV/A_PurchaseReqnItemText (POST)

Sample request payload:

{

    "PurchaseRequisition": "12345678",

    "PurchaseRequisitionItem": "10",

    "DocumentText": "B02",

    "TechnicalObjectType": "EBAN",

    "Language": "EN",

    "NoteDescription": "Sample note"

}

The above sample request will create a note of type 'B02' in item "10" of purchase requisition "12345678". It is mandatory to provide the purchase requisition number, "PurchaseRequisition", item number,"PurchaseRequisitionItem", note type, "DocumentText" and note, "NoteDescription" in the request payload.

Updating Item Notes

You can update an item note of a particular note type in a purchase requisition item as follows -

https://<host>/sap/opu/odata/SAP/API_PURCHASEREQ_PROCESS_SRV/A_PurchaseReqnItemText(PurchaseRequisition='12345678',PurchaseRequisitionItem='10', DocumentText='B01',TechnicalObjectType='EBAN',Language='EN') (PATCH)

Sample request payload:

{

    "NoteDescription": "Update the note"

}

The above sample request will update the note for type 'B01' in item "10" of purchase requisition "12345678".

Deleting Item Notes

You can delete an item note of a particular note type in a purchase requisition item as follows -

https://<host>/sap/opu/odata/SAP/API_PURCHASEREQ_PROCESS_SRV/A_PurchaseReqnItemText(PurchaseRequisition='12345678', PurchaseRequisitionItem='10',DocumentText='B01',TechnicalObjectType='EBAN',Language='EN') (DELETE)

The above sample request will delete the note for type 'B01' in item "10" of purchase requisition "12345678". 

Some related links for reference –

  1. FAQs
  2. API Hub – Purchase Requisition
  3. Business documentation

Thanks for going through the blog posts. Let us know your suggestions in comments section below.