SAP EWM 9.5 introduced a very useful option for e-commerce warehouses, which makes it possible to reduce the quantity in a sales order. Let us look at this feature in more detail.
This functionality allows the quantity in a sales order to be reduced (including down to 0) even when the outbound delivery has already been distributed to EWM and pick warehouse tasks have been created. How does it work?

- If no pick warehouse tasks have been created, the quantity in the outbound delivery order is simply changed.
- If warehouse tasks have been created, they are cancelled and the quantity in the outbound delivery order is changed. But you will have to trigger the creation of new tasks.
- If the pick warehouse tasks have already been confirmed, the corresponding indicator is set in the delivery item status and in the stock quant itself. Then, at the packing work center, when the stock is scanned, the information is shown to the warehouse employee so that they can take the necessary action for this order – for example unpack part of the order (or the whole order) together with a cancellation of picking.
Note: in the code this is handled by the method check_huitm_order_reduction in the include /SCWM/LUI_PACKINGS05:

And to make it possible to cancel picking right away, SAP added a new programming interface /SCWM/IF_API_CANCEL_PICKING, which allows the cancellation methods to be called from various user interfaces – in our case from the packing work center:

In the EWM settings the functionality is activated at warehouse process type level:

A new quantity role «Cancel» has also appeared at delivery item level:

And at the status level of the outbound delivery order item – the status «DCA Order Reduction»:

Plus a new date in the delivery item, «TCANCORD», which records the time of the order reduction:

A new field «QITM_CANCEL: Order Item Reduced» has appeared in the quant table:

When the order quantity is changed in ERP, the system first checks whether this is possible: the function module /SCWM/OUTB_DLV_CHECK_RED_ORDER is called via RFC. The function module returns the following table:

Along with this functionality SAP delivered two BAdIs:
/SCWM/EX_ERP_OD_PREDICT_ORDRED - BAdI: Prediction Service for Order Reduction
There is a fallback class /SCWM/CL_EI_ERP_OD_PRED_ORDRED. This BAdI is called at the end of the function module /SCWM/OUTB_DLV_CHECK_RED_ORDER and is used to adjust the standard logic that decides whether the quantity may be reduced. The BAdI returns the same fields as the function module.
/SCWM/EX_DLV_ORD_RED_WT_SORT - BAdI: Sorting of Warehouse Tasks for Partial Cancellations
This BAdI is called when ERP sends a request to reduce the quantity in an outbound delivery order while several pick warehouse tasks exist and the system has to decide which of them to cancel. There is a fallback class /SCWM/CL_EI_DLV_ORD_RED_WT_SRT, in which the default sorting is by the quantity in the warehouse task, from smallest to largest. Accordingly, this BAdI lets you re-sort the tasks according to your own logic.