Symptom
An error message "The requested service is not supported by entity CDS~A_SALESORDERWITHOUTCHARGE" with status code 500 is displayed when attempting to add an item using the API_SALES_ORDER_WITHOUT_CHARGE_SRV API. The issue arises when attempting to create a single item entity for a sales order without charge, using the OData V2 API.
Environment
SAP S/4HANA Cloud Public Edition
Reproducing the Issue
- Attempt to add an item using the API_SALES_ORDER_WITHOUT_CHARGE_SRV API.
- The error message "The requested service is not supported by entity CDS~A_SALESORDERWITHOUTCHARGE" is displayed.
Cause
The issue arises because the OData V2 API does not support the creation of a single item entity without an item partner entity for a sales order without charge. As mentioned in the "Overview" section of API Hub - Sales Order Without Charge (A2X): For existing sales orders without charge, you can create new items. Note that you must use "deep insert" requests (with the entity: item partner). You cannot create entities without including any related entitie.
Resolution
(1) When using the OData V2 API, it is a must to include the "Item Partner" entity in the payload. Below is an example body from Help Portal - Create Sales Order Without Charge Item to create an item with partner information for sales order without charge 50242:
{"SalesOrderWithoutCharge": "50242","Material": "TG11","RequestedQuantity": "2","PurchaseOrderByCustomer": "Created via OData","to_Partner": [ { "PartnerFunction": "SH", "Customer": "10100003" } ]}
(2) Alternatively, use the OData V4 API, which supports the creation of single item entities. According to API Hub - Sales Order Without Charge (A2X) - V4: "For existing sales orders without charge, you can create the following sub-entities on their own: header partner, header text, item, item partner, and item text".
See Also
Keywords
API_SALES_ORDER_WITHOUT_CHARGE_SRV, OData V2, OData V4, Sales Order, SAP S/4HANA Cloud Public Edition, Item Partner, Error, CDS~A_SALESORDERWITHOUTCHARGE. , KBA , SD-SLS-API-2CL , API (Public Cloud) , Problem