READ operation for API Purchase Contract ( API_PURCHASECONTRACT_PROCESS_SRV ).
API business hub is the perfect starting point for your API journey , you can use it to see the response as well as to work with different options delivered with the API.
For this particular blog we will take an example of Purchase contract API and will create a purchase contract , add a new item and update header as well as item data.
API Hub – https://api.sap.com/
Search for the Purchase contract, and select the Purchase Contract ODATA API.
Prerequisite – Your system is connected and configured to API Hub.
Now to test it out with your connected system , Log In with your credentials and click on Configure Environment to connect to your S4 system.
In the snapshot posted above , on the left hand side we have different nodes which are supported by this API namely-
1. A_PurchaseContarct (Header Node) – Purchase Contract Header Data
2. A_PurchaseContractItem (Item Node) – Purchase Contract Item Data
3. A_PurCtrPartners (Partner Node ) – Purchase Contract Partner Data
4. A_PurContrItemCondition (Condition Node) – Purchase Contract Item Price Conditions
5. A_PurCtrAccount (Account Assignments Node) – Purchase Contract Item Account Assignments
6. A_PurCtrAddress (Address Node) – Purchase Contract Address
And the Last
7. Batch Requests – This option can be used for any node to perform operations in a BATCH request . Since this API ONLY supports BATCH requests for Update of existing contract, we will do all our UPDATE and INSERT (Addition of new item etc.) here.
As part of this blog series we will explore the GET operation of this API in this blog.
Various ODATA parameters are supported by this API for example-
1. $top – Can be used to fetch first n number of records.
2.$skip – Can be used to skip first n records and fetch the rest.
3. $filter – Can be used to filter the result set.
For example – PurchaseContract eq ‘4600000075’ can be used to filter the result set for Purchase Contract – 4600000075 .
4. $Inlinecount – Returns count of number of entities.
5. $orderby – Option to sort the result set , we have two options here either to sort by a field in ascending or descending order. The fields are listed by which sorting can be done.
6. $select – We can select the fields which needs to be part of result set.
7. $expand – Can be used to fetch the expanded entity result set. Here for purchase contract header (parent) we have Items and Partners as child entity sets.
Click on Execute and if the GET call is successful we will get HTTP code as 200 and Contract details in the response.
This covers the GET operations.
Insert (POST) and Update (PATCH) options will be covered in the next blogs.
Insert (POST) Operation – https://blogs.sap.com?p=339
Update (PATCH & POST) Operation – https://blogs.sap.com?p=335
Thanks Rishi for this...just now one customer request steps for this same thing...
Than you for posting this. Its very userfull!
Former Member Thank you for Sharing, Could you also share the link/doc about how to u connect & configure our system to API Hub.
Hi Rishi, thanks for sharing the details, as mentioned by Anup, would you please share more details about thow to setup the connection to our own system to API hub?
I cannot find any documentation on expanding the API with customer fields. Is there a possibility foreseen in the standard?
any link to doucmentation welcome!
Hi Phillip ,
Sorry for late Reply somehow the blogs is no longer visible in my profile as my content and I never got any notification for you question , yes this is possible via the custom fields & logic app.
You need to add the field and then expose it to the ODATA service , it will then be available with this API.