MANAGING DELIVERY ADDRESS

The delivery address is the address that the buyer wants the order or shipment to arrive at. This delivery address maintained in the purchase requisition item shall be taken over by further documents as and when required. Therefore shall be single and unique for every item in a purchase requisition.

Continuing our series of Blogs for Purchase Requisition OData API, in this blog we focus on Delivery Address within a Purchase Requisition.

As per the embedded document structure, the following is the nesting for delivery address in a Purchase Requisition –


Purchase Requisition header


                PR Item1, PR Item 2, . . . . . . . . .PR Item n

                                Delivery Address 1, Delivery Address 2, . . . . . . . . . . . . . . . . Delivery Address n

There is thus a 1-to-1 mapping between a Purchase Requisition item and delivery address.

The AddressID fields such as ManualDeliveryAddressID and DeliveryAddressID are relevant and are read-only fields for an end-user. DeliveryAddressID contains the updated AddressID considering all below scenarios while creating or updating the delivery address. ManualDeliveryAddressID shall be filled only in case the requisition contains a user-defined delivery address.

Following CRUD operations are supported for Delivery Address in Purchase Requisition: -

1.       Create – While creating a purchase requisition we can create Delivery address in following modes –

a.      Storage Location Address (Address Type L)

A requisition is created with Storage Location address as Delivery Address, in case no manual address is provided in the create payload and one of the following conditions is satisfied-

·         The user sends ‘storage location’ in item entity

OR

·         For the given Material and Plant combination, a storage location defaults in system configuration.

b.      Plant Address (Address Type P)

A requisition is created with Plant address as the delivery address, in case no address is provided in the create payload and a valid plant are provided in the create payload.

Also, in case the storage location address saved in the system configuration is invalid and no manual address is provided in the create payload, the delivery address of the requisition is set to plant address by default.

c.       User-defined Address (Address Type U)

A requisition is created with User-Defined address as the delivery address, in case a manual address is provided in the Create payload.

2.       Read – You can read the delivery address using the following operations :

a.       Reading delivery address of a purchase requisition item

GET https://<host>/sap/opu/odata/SAP/API_PURCHASEREQ_PROCESS_SRV/A_PurReqAddDelivery(PurchaseRequisition=10005263,PurchaseRequisitionItem=10)/to_PurchaseReqnDeliveryAddress

OR

GET https://<host>/sap/opu/odata/SAP/API_PURCHASEREQ_PROCESS_SRV/A_PurReqAddDelivery(PurchaseRequisition=10005263,PurchaseRequisitionItem=10)

b.      Reading Delivery addresses for all the items in the system

GET https://<tenant>-api. s4hana.ondemand.com/sap/opu/odata/SAP/ API_PURCHASEREQ_PROCESS_SRV/A_PurReqAddDelivery

3.       Update – Delivery Address details can be updated as a batch operation or as a PATCH on delivery address entity. Example –

PATCH https://<host>/sap/opu/odata/SAP/API_PURCHASEREQ_PROCESS_SRV/A_PurReqAddDelivery(PurchaseRequisition=10005263,PurchaseRequisitionItem=10)

{

“Country”:”IN”

}

Following transitions are valid in case of delivery address update: -

·         Storage Location(L) à User Defined (U) 

·         Plant(P) à User Defined(D) 

Note that once the address is modified by the end-user it is not possible to get the default address back for a requisition item that is  the following transition is not possible

·         User Defined(U) à Storage Location(L) or Plant(P) ×

For details related to updatable and read-only(non-updatable) fields kindly refer to the help documentation.

4.       Delete – The deletion of a delivery address is NOT supported due to business reasons!

Related Links for OData API_PURCHASEREQ_PROCESS_SRV

·         API Hub

·         Business Documentation

All Episodes on PR OData API:

·         Part 1 - Purchase Requisition OData API Ep. 1

·         Part 2 - Purchase Requisition OData API Ep. 2

·         Part 3 - Purchase Requisition OData API Ep. 3

·         Part 4 - Purchase Requisition OData API Ep. 4