I am trying to add Tracking Spec entry through code;
rec_trackingspec.init();
if rec_trackingspec2.FindLast() then
rec_trackingspec."Entry No." := rec_trackingspec2."Entry No." + 1 else
rec_trackingspec."Entry No." := 1;
rec_trackingspec."Creation Date" := WorkDate();
rec_trackingspec.Positive := true;
rec_trackingspec.Validate("Item No.", rec_SalesLine."No.");
rec_trackingspec.Validate("Lot No.", rec_itemledgerentry."Lot No.");
rec_trackingspec."Location Code" := 'MAIN';
rec_trackingspec.Validate("Quantity (Base)", rec_SalesLine.Quantity);
rec_trackingspec.Validate("Bin Code", rec_SalesLine."Bin Code");
rec_trackingspec."Source Ref. No." := rec_SalesLine."Line No.";
rec_trackingspec.Insert(true);
Checking through debugger, I see Insert(true) gets executed, however when i go to check if Tracking Spec has the line I intended to insert, it does not show the entry there.
Check whether there is a code after the INSERT that reverse all the changes like an ERROR command.