SAP Message VW521 - Leg &1: Delivery &2 cannot be assigned because it is not in the shipment

Diagnosis
The system has tried to assign a delivery to a leg but the delivery isnot in this shipment.

System Response
The system issues an error message and stops processing.