Reserve 2 sales lines against 1 transfer order line

Toddy_BoyToddy_Boy Member Posts: 231
I'm trying to reserve 2 (or more) sales lines against a transfer order line. I've created a new procedure in Form 99000896, I set the transfer order line which I wish to reserve against, then call the procedure passing in the sales line to reserve. Within the procedure I have the folllowing code which mimics clicking the reserve button. This works fine for the first sales line but when called with the second line, the second line is reserved ok but the reservation on the first line disappears - why?? ](*,) ](*,)
SalesLine := SalesLineInBound;
Direction := Direction::Inbound;

ReservEntry."Source Type" := DATABASE::"Sales Line";
ReservEntry."Source Subtype" := SalesLineInBound."Document Type";
ReservEntry."Source ID" := SalesLineInBound."Document No.";
ReservEntry."Source Ref. No." := SalesLineInBound."Line No.";
ReservEntry."Item No." := SalesLineInBound."No.";
ReservEntry."Variant Code" := SalesLineInBound."Variant Code";
ReservEntry."Location Code" := SalesLineInBound."Location Code";
ReservEntry."Shipment Date" := SalesLineInBound."P&P Date";
ReservEntry.Description := 'Auto Reserve';

UpdateReservFrom;
SetSalesLine(SalesLine, ReservEntry);

Rec."Outstanding Qty. (Base)" := Rec."Qty. Shipped (Base)";

ReservMgt.TransferLineUpdateValues(Rec,QtyToReserve,QtyReservedThisLine,Direction);

ReservEntry.LOCKTABLE;
UpdateReservMgt;
ReservMgt.TransferLineUpdateValues(Rec,QtyToReserve,QtyReservedThisLine,Direction);
NewQtyReservedThisLine := ReservMgt.CalculateRemainingQty;
ReservMgt.CopySign(NewQtyReservedThisLine,QtyToReserve);

IF NewQtyReservedThisLine <> 0 THEN BEGIN
  IF NewQtyReservedThisLine > QtyToReserve THEN BEGIN
    CreateReservation(QtyToReserve)
  END ELSE BEGIN
    CreateReservation(NewQtyReservedThisLine)
  END;
END ELSE BEGIN
  ERROR(Text001);
END;

Any ideas to stop the instanity
Life is for enjoying ... if you find yourself frowning you're doing something wrong
Sign In or Register to comment.