web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

You must assign a lot number

(0) ShareShare
ReportReport
Posted on by 18
I'm trying to make item reclassification journal by code but when I put it in, it keeps saying must assign a lot number. Here is the code snippet. Basically I put the item journal line with reservation entry by code. but still get the problem of assigning lot number. Could you please help me to find the problem?
 
 if LotNoInfo.FindSet() then
            repeat
                LotNoInfo.CalcFields(Inventory);
 
                if ((LotNoInfo."Expire Date" <= TodayDate) or
                    (LotNoInfo."Retest Date" <= TodayDate)) and
                   (LotNoInfo.Inventory > 0) then begin
                    ItemLedgEntry.Reset();
                    ItemLedgEntry.SetRange("Item No.", LotNoInfo."Item No.");
                    ItemLedgEntry.SetRange("Lot No.", LotNoInfo."Lot No.");
                    ItemLedgEntry.SetFilter("Remaining Quantity", '>0');
 
                    if ItemLedgEntry.FindSet() then
                        repeat
                            WarehouseEntry.Reset();
                            WarehouseEntry.SetRange("Item No.", ItemLedgEntry."Item No.");
                            WarehouseEntry.SetRange("Lot No.", ItemLedgEntry."Lot No.");
                            WarehouseEntry.SetRange("Location Code", ItemLedgEntry."Location Code");
                            WarehouseEntry.SetRange("Reference No.", ItemLedgEntry."Document No.");
                            if WarehouseEntry.FindLast() and (WarehouseEntry."Bin Code" <> '') then begin
                                LineNo += 10000;
 
                                ItemReclassJournalLine.Init();
                                ItemReclassJournalLine."Entry Type" := ItemReclassJournalLine."Entry Type"::Transfer;
                                ItemReclassJournalLine."Journal Template Name" := ItemReclassJournalTemplate.Name;
                                ItemReclassJournalLine."Journal Batch Name" := ItemReclassJournalBatch.Name;
                                ItemReclassJournalLine."Line No." := LineNo;
                                ItemReclassJournalLine."Posting Date" := TodayDate;
                                ItemReclassJournalLine."Document No." := 'ttttt';
 
                                ItemReclassJournalLine.Validate("Item No.", LotNoInfo."Item No.");
                                ItemReclassJournalLine.Validate("Location Code", ItemLedgEntry."Location Code");
                                ItemReclassJournalLine.Validate("Variant Code", ItemLedgEntry."Variant Code");
                                ItemReclassJournalLine.Description := 'ttttt';
                                ItemReclassJournalLine.Validate(Quantity, ItemLedgEntry."Remaining Quantity");
                                ItemReclassJournalLine.Validate("New Location Code", 'tttt');
                                ItemReclassJournalLine.Validate("New Bin Code", 'tttt');
 
                                ItemReclassJournalLine.Validate("Lot No.", LotNoInfo."Lot No.");
                                ItemReclassJournalLine.Validate("New Lot No.", LotNoInfo."Lot No.");
 
                                ItemReclassJournalLine.Validate("Bin Code", WarehouseEntry."Bin Code");
                                ItemReclassJournalLine.Insert();
 
                                EntryNo := 0;
                                ReservEntry.Reset();
                                if ReservEntry.FindLast() then
                                    EntryNo := ReservEntry."Entry No.";
                                EntryNo += 1;
 
                                ReservEntry.Init();
                                ReservEntry."Entry No." := EntryNo
                                ReservEntry."Item No." := ItemReclassJournalLine."Item No.";
                                ReservEntry."Variant Code" := ItemReclassJournalLine."Variant Code";
                                ReservEntry."Location Code" := ItemReclassJournalLine."Location Code";
                                ReservEntry."Lot No." := LotNoInfo."Lot No.";
                                ReservEntry."New Lot No." := LotNoInfo."Lot No.";
                                ReservEntry."Quantity (Base)" := ItemLedgEntry."Remaining Quantity";
                                ReservEntry."Reservation Status" := ReservEntry."Reservation Status"::Surplus;
                                ReservEntry."Source Type" := DATABASE::"Item Journal Line";
                                ReservEntry."Source Subtype" := ItemReclassJournalLine."Entry Type".AsInteger();
                                ReservEntry."Source ID" := ItemReclassJournalLine."Journal Template Name";
                                ReservEntry."Source Batch Name" := ItemReclassJournalLine."Journal Batch Name";
                                //ReservEntry."Source Ref. No." := ItemReclassJournalLine."Line No.";
                                ReservEntry."Positive" := true;
                                ReservEntry.Insert();
                                ReservEntry.Modify();
                            end;
                        until ItemLedgEntry.Next() = 0;
                end;
            until LotNoInfo.Next() = 0;
I have the same question (1)
  • Suggested answer
    Ramiz Profile Picture
    597 on at
    Hi,

    Try adding this.
     
    ReservationEntry.Validate("Item Tracking", ReservationEntry."Item Tracking"::"Lot No.");

     
  • JC-10102114-0 Profile Picture
    18 on at
    Thank you for the reply Ramiz. However, the problem is not solved with adding the code :c
  • Gerardo Rentería García Profile Picture
    25,213 Most Valuable Professional on at
  • JC-10102114-0 Profile Picture
    18 on at
    Hi gdrenteria,
     
    I appreciate you r URLs. However, the links are already checked and were not working :c

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans
Liquid error: parsing "/globalsearch/?q=co+to+jest+alba++krzy%C5%BC%C3%B3wka" - Nested quantifier +.