Lot No does not work when it is generated by code in transfer lines

MuazDeyab
Member Posts: 1
I am creating transfer order by code and it works but i want to assign lot no also i wrote this code
procedure AssignLotNO(transLine: Record "Transfer Line")
var
EntryNo: Integer;
begin
if LastTRackingSPecs.FindLast() then
EntryNo := LastTRackingSPecs."Entry No." + 1;
GetItem(transLine."Item No.");
TRackingSpecs.InitFromTransLine(transLine, transLine."Shipment Date", Direction::Outbound);
TRackingSpecs.Validate("Quantity Handled (Base)", 0);
TRackingSpecs.Validate("Quantity Invoiced (Base)", 0);
AssignNewLotNo(TRackingSpecs);
TRackingSpecs."Qty. Rounding Precision (Base)" := 1;
TRackingSpecs.Validate("Quantity (Base)", transLine.Quantity);
TRackingSpecs."Entry No." := EntryNo;
TRackingSpecs.Insert();
TRackingSpecs."Qty. per Unit of Measure" := 1;
TempItemTrackLineInsert.TransferFields(TRackingSpecs);
TempItemTrackLineInsert.Insert();
CreateReservationEntry(transLine, ILE);
end;
/////////////////////////////////////////////////////////////////////////////
local procedure AssignNewLotNo(var specs: Record "Tracking Specification")
var
IsHandled: Boolean;
begin
Item.TestField("Lot Nos.");
specs.Validate("Lot No.", NoSeriesMgt.GetNextNo(Item."Lot Nos.", WorkDate(), true));
end;
///////////////////////////////////////////////////////////////////////
local procedure CreateReservationEntry(TransLines: Record "Transfer Line"; ILE: Record "Item Ledger Entry")
begin
if LastResEntry.FindLast() then
NextEntryNo := LastResEntry."Entry No." + 1;
if not Item.Get(TransLines."Item No.") then
exit;
Item.TestField("Item Tracking Code");
Item.TestField("Lot Nos.");
ReservationEntry.Init();
ReservationEntry."Entry No." := NextEntryNo;
ReservationEntry.validate("Item No.", TransLines."Item No.");
ReservationEntry.Description := TransLines.Description;
ReservationEntry.validate("Location Code", TransLines."Transfer-from Code");
ReservationEntry.Validate("Quantity (Base)", -TransLines."Qty. to Receive (Base)");
ReservationEntry.validate("Reservation Status", ReservationEntry."Reservation Status"::Surplus);
ReservationEntry.validate("Source Type", Database::"Transfer Line");
ReservationEntry.validate("Source Subtype", ReservationEntry."Source Subtype"::"1");
ReservationEntry.validate("Source ID", TransLines."Document No.");
ReservationEntry.validate("Source Ref. No.", TransLines."Line No.");
ReservationEntry.validate("Shipment Date", TransLines."Shipment Date");
ReservationEntry.validate("Qty. per Unit of Measure", TransLines."Qty. per Unit of Measure");
ReservationEntry.VALIDATE("Lot No.", ILE."Lot No.");
ReservationEntry.Validate("Package No.", ILE."Package No.");
ReservationEntry.validate("Item Tracking", ReservationEntry."Item Tracking"::"Lot and Package No.");
ReservationEntry."Created By" := UserId;
ReservationEntry.Positive := true;
ReservationEntry."Creation Date" := WorkDate();
ReservationEntry.Insert(true);
LotNo := ReservationEntry."Lot No.";
end;
/////////////////////////////////////////
local procedure GetItem(ItemNo: Code[20])
var
begin
if Item."No." <> ItemNo then begin
Item.Get(ItemNo);
Item.TestField("Item Tracking Code");
if ItemTrackingCode.Code <> Item."Item Tracking Code" then
ItemTrackingCode.Get(Item."Item Tracking Code");
end;
end;
it assigns lot no in item tracking lines but when i try to post the transfer order it given me that "You must assign a lot number for item" even though when i open item tracking lines there is Lot No assigned
procedure AssignLotNO(transLine: Record "Transfer Line")
var
EntryNo: Integer;
begin
if LastTRackingSPecs.FindLast() then
EntryNo := LastTRackingSPecs."Entry No." + 1;
GetItem(transLine."Item No.");
TRackingSpecs.InitFromTransLine(transLine, transLine."Shipment Date", Direction::Outbound);
TRackingSpecs.Validate("Quantity Handled (Base)", 0);
TRackingSpecs.Validate("Quantity Invoiced (Base)", 0);
AssignNewLotNo(TRackingSpecs);
TRackingSpecs."Qty. Rounding Precision (Base)" := 1;
TRackingSpecs.Validate("Quantity (Base)", transLine.Quantity);
TRackingSpecs."Entry No." := EntryNo;
TRackingSpecs.Insert();
TRackingSpecs."Qty. per Unit of Measure" := 1;
TempItemTrackLineInsert.TransferFields(TRackingSpecs);
TempItemTrackLineInsert.Insert();
CreateReservationEntry(transLine, ILE);
end;
/////////////////////////////////////////////////////////////////////////////
local procedure AssignNewLotNo(var specs: Record "Tracking Specification")
var
IsHandled: Boolean;
begin
Item.TestField("Lot Nos.");
specs.Validate("Lot No.", NoSeriesMgt.GetNextNo(Item."Lot Nos.", WorkDate(), true));
end;
///////////////////////////////////////////////////////////////////////
local procedure CreateReservationEntry(TransLines: Record "Transfer Line"; ILE: Record "Item Ledger Entry")
begin
if LastResEntry.FindLast() then
NextEntryNo := LastResEntry."Entry No." + 1;
if not Item.Get(TransLines."Item No.") then
exit;
Item.TestField("Item Tracking Code");
Item.TestField("Lot Nos.");
ReservationEntry.Init();
ReservationEntry."Entry No." := NextEntryNo;
ReservationEntry.validate("Item No.", TransLines."Item No.");
ReservationEntry.Description := TransLines.Description;
ReservationEntry.validate("Location Code", TransLines."Transfer-from Code");
ReservationEntry.Validate("Quantity (Base)", -TransLines."Qty. to Receive (Base)");
ReservationEntry.validate("Reservation Status", ReservationEntry."Reservation Status"::Surplus);
ReservationEntry.validate("Source Type", Database::"Transfer Line");
ReservationEntry.validate("Source Subtype", ReservationEntry."Source Subtype"::"1");
ReservationEntry.validate("Source ID", TransLines."Document No.");
ReservationEntry.validate("Source Ref. No.", TransLines."Line No.");
ReservationEntry.validate("Shipment Date", TransLines."Shipment Date");
ReservationEntry.validate("Qty. per Unit of Measure", TransLines."Qty. per Unit of Measure");
ReservationEntry.VALIDATE("Lot No.", ILE."Lot No.");
ReservationEntry.Validate("Package No.", ILE."Package No.");
ReservationEntry.validate("Item Tracking", ReservationEntry."Item Tracking"::"Lot and Package No.");
ReservationEntry."Created By" := UserId;
ReservationEntry.Positive := true;
ReservationEntry."Creation Date" := WorkDate();
ReservationEntry.Insert(true);
LotNo := ReservationEntry."Lot No.";
end;
/////////////////////////////////////////
local procedure GetItem(ItemNo: Code[20])
var
begin
if Item."No." <> ItemNo then begin
Item.Get(ItemNo);
Item.TestField("Item Tracking Code");
if ItemTrackingCode.Code <> Item."Item Tracking Code" then
ItemTrackingCode.Get(Item."Item Tracking Code");
end;
end;
it assigns lot no in item tracking lines but when i try to post the transfer order it given me that "You must assign a lot number for item" even though when i open item tracking lines there is Lot No assigned
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions