cancel
Showing results for 
Search instead for 
Did you mean: 

Get contract Api

06-09-2021 3:37 PM
SAP Managed Tags
Subscribe

Hi All,

is there standard SAP API to get Sales Contract number based on Customer and material IDs,, we are going to post Sales order in S4HC with reference to contract number (using CPI ) using below API

https://api.sap.com/api/API_SALES_ORDER_SRV/resource

but for that we need to get contract number first

Regards

Ghadeer

Accepted Solutions (1)

Accepted Solutions (1)

a_montesdeoca
Product and Topic Expert
Product and Topic Expert

Hi ghadeer_2020,

Please find here the Sales Contract API documentation:

This service enables you to read sales contracts, as well as create, update and delete sales contract headers and items. I recommend to check the entities to analyze your requirement.

Hope this helps.

Arturo Montes de Oca

Answers (1)

Answers (1)

Troy
Product and Topic Expert
Product and Topic Expert

Hi ghadeer_2020,

Currently you can use the Sales Contract (A2X) | API | SAP API Business Hub to read sales contract, but this API is based on OData V2 version, does not support nested filters in $expand. So, you may can using below request to get all sales contract for one customer, then filter the item's material in your app logic.

https://HOST/sap/opu/odata/sap/API_SALES_CONTRACT_SRV/A_SalesContract?$expand=to_Item&filter= SoldToParty eq 'CustomerNumber'.

Or you may can try to enable the extensibility. For example, you can add one custom field to contract item (enable it for both UI and API), e.g. ItemCustomerNumber. When you create the sales contract, set the ItemCustomerNumber same as the customer at header level. Then you can use the filter to query the /A_SalesContractItem entity.

Hope it helps you.

Best Regards,

Troy