SalesUpdateRemain updateDeliverRemainder catch weight quantity errors

Errors: 
  • Illegal splitting. Update has been cancelled.
  • Full catch weight quantity requested was not processed.
    To resolve this issue, go to the order lines -> Stock -> Pick to pick sufficient amount to issue.
    Insufficient stock transactions with status Picked.

Occurs when trying to update the deliver remainder on the sales order line:
SalesUpdateRemain::construct().updateDeliverRemainder(salesLine, salesQty, inventQty, cwQty);
Even though we pass the catch weight quantity to the updateDeliverRemainder() method, it does not set it on the sales line buffer inside. It updates only RemainSalesPhysical and RemainInventPhysical:

        InventQty      diffRemainSalesPhysical       = _salesLine.RemainSalesPhysical               - _remainSalesPhysical;
        InventQty      diffRemainInventPhysical      = _salesLine.RemainInventPhysical              - _remainInventPhysical;
        PdsCWInventQty diffPdsCWRemainInventPhysical = _salesLine.orig().PdsCWRemainInventPhysical  - _cWRemainInventPhysical;

        _salesLine.RemainSalesPhysical  = _remainSalesPhysical;
        _salesLine.RemainInventPhysical = _remainInventPhysical;

        if (_salesLine.RemainInventPhysical)
        {
The fix is to update PdsCWRemainInventPhysical on sales line buffer before calling updateDeliverRemainder() method.
if (PdsGlobal::pdsIsCWItem(salesLine.ItemId))
{
    salesLine.PdsCWRemainInventPhysical = cwQty;
}
SalesUpdateRemain::construct().updateDeliverRemainder(salesLine, salesQty, inventQty, cwQty);
Or a fix for the whole environment, create CoC and update it before calling the next:
/// <summary>
/// An extension class of the <c>SalesUpdateRemain</c> class.
/// </summary>
[ExtensionOf(classStr(SalesUpdateRemain))]
public final class NXRSalesUpdateRemainCls_Extension
{
    /// <summary>
    /// CoC for updateDeliverRemainder() method
    /// </summary>
    /// <param name="_salesLine">
    /// The instance of <c>SalesLine</c> for which delivery remainder is set.
    /// </param>
    /// <param name="_remainSalesPhysical">
    /// New value for remaining physical sales quantity.
    /// </param>
    /// <param name="_remainInventPhysical">
    /// New value for remaining physical inventory quantity.
    /// </param>
    /// <param name="_cWRemainInventPhysical">
    /// New value for remaining physical inventory CW quantity.
    /// </param>
    /// <returns>
    /// true if the line's delivery remainder was successfully updated; otherwise, false.
    /// </returns>
    public boolean updateDeliverRemainder(
        SalesLine      _salesLine,
        InventQty      _remainSalesPhysical,
        InventQty      _remainInventPhysical,
        PdsCWInventQty _cWRemainInventPhysical)
    {
        if (PdsGlobal::pdsIsCWItem(_salesLine.ItemId))
        {
            // even though we pass _cWRemainInventPhysical to updateDeliverRemainder() - it does not set it on the SalesLine buffer and therefore fails
            // setting PdsCWRemainInventPhysical before updateDeliverRemainder() to work in same way as when updating deliver remainder from UI
            _salesLine.PdsCWRemainInventPhysical = _cWRemainInventPhysical;
        }
        return next updateDeliverRemainder(_salesLine, _remainSalesPhysical, _remainInventPhysical, _cWRemainInventPhysical);
    }

}


Support The Author

 If you found value in what I share, I've set up a Buy Me a Coffee page as a way to show your support.

Buy Me a Coffee

Post a Comment


All Comments


No comments. Be the first one to comment on this post.

Search

About

DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics 365 FO.

Authors are allowed to set their own "buy me a coffee" link.
Join us.

Blog Tags