Undo Shipment

johnnyc313johnnyc313 Member Posts: 93
Hi,

I am having a problem with undoing a shipment. I can use the undo function on a posted shipment for items. But how do you deal with the carriage if it has been shipped in error?

Thanks...

JohnnyC

Comments

  • KowaKowa Member Posts: 925
    Either order and post a negative quantity ( this works in simple cases without item tracking, WMS etc.) , and create a new line with the right quantity

    or

    ship & invoice the whole document, copy it into a credit memo, tick the field "Correction" , post the credit memo and create a new order.
    Kai Kowalewski
  • johnnyc313johnnyc313 Member Posts: 93
    Kowa wrote:
    Either order and post a negative quantity ( this works in simple cases without item tracking, WMS etc.) , and create a new line with the right quantity

    or

    ship & invoice the whole document, copy it into a credit memo, tick the field "Correction" , post the credit memo and create a new order.

    Thanks for the reply,

    Does this mean then that you cannot really use the undo shipment function if the order has a carriage line? As there is no problem undoing a straight shipment.
  • KowaKowa Member Posts: 925
    johnnyc313 wrote:
    Does this mean then that you cannot really use the undo shipment function if the order has a carriage line? As there is no problem undoing a straight shipment.
    Yes, if there is an Item Charge Line assigned to the item ( or an invoiced Item Charge for the item exists) the Undo Shipment Function cannot be used.
    Kai Kowalewski
  • johnnyc313johnnyc313 Member Posts: 93
    Kowa wrote:
    johnnyc313 wrote:
    Does this mean then that you cannot really use the undo shipment function if the order has a carriage line? As there is no problem undoing a straight shipment.
    Yes, if there is an Item Charge Line assigned to the item ( or an invoiced Item Charge for the item exists) the Undo Shipment Function cannot be used.

    Thanks for your help.
  • mwilkinsonmwilkinson Member Posts: 7
    It can actually be done as we have had a new funtion added to our system called (undo shipment non-stock) which calls a new codeunit this allows the charge items to be undone.

    The code in the code unit looks like this if it helps!!! (I'm not a programmer so I cannot pass any comment on the code, but it works for us!!!)


    OnRun(VAR Rec : Record "Sales Shipment Line")
    IF NOT FIND('-') THEN
    EXIT;

    IF NOT HideDialog THEN
    IF NOT CONFIRM(Text000) THEN
    EXIT;

    SalesShptLine.COPY(Rec);
    Code;
    Rec := SalesShptLine;

    SetHideDialog(NewHideDialog : Boolean)
    HideDialog := NewHideDialog;

    Code()
    WITH SalesShptLine DO BEGIN
    SETRANGE(Correction,FALSE);

    REPEAT
    IF NOT HideDialog THEN
    Window.OPEN(Text007);
    CheckSalesShptLine(SalesShptLine);
    UNTIL NEXT = 0;

    FIND('-');
    REPEAT
    IF NOT HideDialog THEN
    Window.OPEN(Text001);

    InsertNewShipmentLine(SalesShptLine);

    UpdateSalesOrderLine(SalesShptLine);

    IF ("Blanket Order No." <> '') AND ("Blanket Order Line No." <> 0) THEN
    UpdateBlanketOrder(SalesShptLine);

    "Qty. Shipped Not Invoiced" := 0;
    Correction := TRUE;
    MODIFY;

    UNTIL NEXT = 0;
    END;

    CheckSalesShptLine(SalesShptLine : Record "Sales Shipment Line")
    CLEAR(UsesItemTracking);
    WITH SalesShptLine DO BEGIN
    IF Type = Type::Item THEN
    FIELDERROR(Type,Text67000);

    TESTFIELD(Type);
    TESTFIELD("Qty. Shipped Not Invoiced",Quantity);
    TESTFIELD("Drop Shipment",FALSE);

    END;

    InsertNewShipmentLine(OldSalesShptLine : Record "Sales Shipment Line")
    WITH OldSalesShptLine DO BEGIN
    NewSalesShptLine.SETRANGE("Document No.","Document No.");
    NewSalesShptLine."Document No." := "Document No.";
    NewSalesShptLine."Line No." := "Line No.";
    NewSalesShptLine.FIND('=');

    IF NewSalesShptLine.FIND('>') THEN BEGIN
    LineSpacing := (NewSalesShptLine."Line No." - "Line No.") DIV 2;
    IF LineSpacing = 0 THEN
    ERROR(Text005);
    END ELSE
    LineSpacing := 10000;

    NewSalesShptLine.RESET;
    NewSalesShptLine.INIT;
    NewSalesShptLine.COPY(OldSalesShptLine);
    NewSalesShptLine."Line No." := "Line No." + LineSpacing;
    NewSalesShptLine."Appl.-from Item Entry" := "Item Shpt. Entry No.";
    NewSalesShptLine.Quantity := -Quantity;
    NewSalesShptLine."Qty. Shipped Not Invoiced" := 0;
    NewSalesShptLine."Quantity (Base)" := -"Quantity (Base)";
    NewSalesShptLine.Correction := TRUE;
    NewSalesShptLine.INSERT;

    CopyShipmentLineDimensions(OldSalesShptLine,NewSalesShptLine);

    END;

    UpdateSalesOrderLine(SalesShptLine : Record "Sales Shipment Line")
    WITH SalesShptLine DO BEGIN
    SalesLine.GET(SalesLine."Document Type"::Order,"Order No.",SalesShptLine."Order Line No.");
    SalesLine."Quantity Shipped" := SalesLine."Quantity Shipped" - Quantity;
    SalesLine."Qty. Shipped (Base)" := SalesLine."Qty. Shipped (Base)" - "Quantity (Base)";
    SalesLine.InitOutstanding;
    SalesLine.InitQtyToShip;
    SalesLine.MODIFY;
    END;

    CopyShipmentLineDimensions(FromSalesShptLine : Record "Sales Shipment Line";ToSalesShptLine : Record "Sales Shipment Line")
    FromPostedDocDim.SETRANGE("Table ID",DATABASE::"Sales Shipment Line");
    FromPostedDocDim.SETRANGE("Document No.",FromSalesShptLine."Document No.");
    FromPostedDocDim.SETRANGE("Line No.",FromSalesShptLine."Line No.");

    IF FromPostedDocDim.FIND('-') THEN
    REPEAT
    ToPostedDocDim.COPY(FromPostedDocDim);
    ToPostedDocDim."Document No." := ToSalesShptLine."Document No.";
    ToPostedDocDim."Line No." := ToSalesShptLine."Line No.";
    ToPostedDocDim.INSERT;
    UNTIL FromPostedDocDim.NEXT = 0;

    UpdateBlanketOrder(SalesShptLine : Record "Sales Shipment Line")
    WITH SalesShptLine DO BEGIN
    IF BlanketOrderLine.GET(
    BlanketOrderLine."Document Type"::"Blanket Order","Blanket Order No.","Blanket Order Line No.")
    THEN BEGIN
    BlanketOrderLine.TESTFIELD(Type,Type);
    BlanketOrderLine.TESTFIELD("No.","No.");
    BlanketOrderLine.TESTFIELD("Sell-to Customer No.","Sell-to Customer No.");

    IF BlanketOrderLine."Qty. per Unit of Measure" = "Qty. per Unit of Measure" THEN
    BlanketOrderLine."Quantity Shipped" := BlanketOrderLine."Quantity Shipped" - Quantity
    ELSE
    BlanketOrderLine."Quantity Shipped" :=
    BlanketOrderLine."Quantity Shipped" -
    ROUND("Qty. per Unit of Measure" / BlanketOrderLine."Qty. per Unit of Measure" * Quantity,0.00000001);

    BlanketOrderLine."Qty. Shipped (Base)" := BlanketOrderLine."Qty. Shipped (Base)" - "Quantity (Base)";
    BlanketOrderLine.InitOutstanding;
    BlanketOrderLine.MODIFY;
    END;
    END;
  • ClaudioPereiraClaudioPereira Member Posts: 38
    Hello

    I've tryied that code but i get a error message:

    "Qty Shipped Not Invoiced must be 1 in Sales Shipment Line Document No.='MyDocNo', Line No.=30000"

    could you please send me the codeunit you've used?
  • mwilkinsonmwilkinson Member Posts: 7
    The code that I have already posted is all of the code unit.

    The error message you are receiving is actually telling you that you have invoiced the shipment.

    You can only undo the lines if you have not invoiced them.

    I suggest you make a shipment and then try undoing it immediately. You should then find it works.
Sign In or Register to comment.