SAP Knowledge Base Article - Public

3705195 - "Resource not found for the segment 'to_Item'" when using Outbound Delivery (A2X) API in SAP S/4HANA Cloud Public Edition

Symptom

When using the Outbound Delivery (A2X) API API_OUTBOUND_DELIVERY_SRV to retrieve outbound delivery data, the request fails with HTTP status code 404 – Not Found.

For example, when executing a request containing an $expand parameter:

GET <host>/sap/opu/odata/sap/API_OUTBOUND_DELIVERY_SRV;v=2/A_OutbDeliveryHeader?$expand=to_Item

the following error message is returned:

Resource not found for the segment 'to_Item'

The outbound delivery header and item data cannot be retrieved as expected within the same API request.

Environment

SAP S/4HANA Cloud Public Edition

Reproducing the Issue

  1. Use the Outbound Delivery (A2X) API API_OUTBOUND_DELIVERY_SRV.
  2. Execute a GET request to retrieve outbound delivery header and item data using the following $expand parameter, for example:
    GET <host>/sap/opu/odata/sap/API_OUTBOUND_DELIVERY_SRV;v=2/A_OutbDeliveryHeader?$expand=to_Item
  3. Execute the request.
  4. The request fails with HTTP status code 404 – Not Found and the following error message:
    Resource not found for the segment 'to_Item'

Cause

The segment to_Item specified in the $expand parameter is not a navigation property exposed by the A_OutbDeliveryHeader entity in the Outbound Delivery (A2X) API.

When a segment that is not defined for the respective entity is specified in the request, the OData service cannot resolve the requested resource.

Resolution

To retrieve an outbound delivery header together with its corresponding items, use the supported navigation property to_DeliveryDocumentItem instead of to_Item.

For example:

Retrieve a single outbound delivery:

GET <host>/sap/opu/odata/sap/API_OUTBOUND_DELIVERY_SRV;v=2/A_OutbDeliveryHeader(DeliveryDocument='80000001')

Retrieve a single outbound delivery including all outbound delivery items:

GET <host>/sap/opu/odata/sap/API_OUTBOUND_DELIVERY_SRV;v=2/A_OutbDeliveryHeader(DeliveryDocument='80000001')?$expand=to_DeliveryDocumentItem

The following entities can be accessed directly:

A_OutbDeliveryHeader
A_OutbDeliveryItem
A_OutbDeliveryDocFlow

Other related entities can be accessed through the navigation properties available from the supported entities.

See Also

SAP Help Portal – Retrieve Outbound Delivery

SAP Business Accelerator Hub – Outbound Delivery (A2X)

Keywords

outbound delivery, a2x api, sap s/4hana cloud public edition, resource not found, to_item segment, 404 error, api request, delivery document, delivery header, delivery item, api outbound delivery srv, error resolution , KBA , LE-SHP-API-2CL , Interfaces for Delivery Documents (API) (Public Cloud) , How To

Product

SAP S/4HANA Cloud Public Edition all versions