Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

How to create Item tracking line from C/AL

(0) ShareShare
ReportReport
Posted on by

Hi all!

In my custome module I have code which creates item journal lines. For these item journal lines I would like to create tracking via lot no, but I dont know how.

I would really appreciate it if someone could write an example of how to do that. I assume I have to create a TempItemTrackLine and insert it. But which variables should I set? and what to do after that?

Thanks in advance

*This post is locked for comments

  • ThomasM Profile Picture
    20 on at
    RE: How to create Item tracking line from C/AL

    Did you check the reservation entries created? Are the Lot No.'s inserted there correctly? I don't know about BC but I guess the reservation logic is still the same. So you have to write the Lot No. into the second reservation entry by yourself.

  • keoma Profile Picture
    32,717 on at
    RE: How to create Item tracking line from C/AL

    did you test with items with item tracking or without?

    check if Lotline is empty.

    also check if ItemHasLot is true.

  • PHT80 Profile Picture
    40 on at
    RE: How to create Item tracking line from C/AL

    Hi everyone, I need your help.
    I am working on an Extension for 365BC and I need create Item tracking line. I am using the code above, but when I go to the Item Tracking Lines window, the "Lot No." field is empty.
    What I can do?

    thanks in advance

  • ThomasM Profile Picture
    20 on at
    RE: How to create Item tracking line from C/AL

    Hi catiamatos1991,

    basically u need to use the codeunit Reservation Management as stated here earlier. The ID is: 99000845

    You basically just set the Kind of record you want to create a reservation for, in this example it's the sales order line, therefore the SetSalesLine Function is used, but there are a couple more functions like this.

    Then you just have to call the AutoReserve Method and you can leave the rest to NAV and it creates 2 reservation entries for you! One is positive and one negative (input/output)

    There is only one thing you need to keep in mind:

    I don't know why, but NAV does not set the "Lot No." into the second reservation entry (output - related to your document). You'll need to set this one by yourself, in my example i do this into the last code lines starting with: lcuSalesLineReserve.FilterReservFor(lReservationEntry,pioSalesLine); this returns the just created reservation entry and I had to get the Lot No. from it and write it to the other one to see the information into your item tracking page in the client (generally called by: lines -> item tracking)

    I hope that helps!

    PS.: I hope you got a developer license to dive into these CU's and research on your own a little bit - it helped me a lot to understand what NAV is doing here!

  • Community Member Profile Picture
    on at
    RE: How to create Item tracking line from C/AL

    Can you explain me this function better pls? There is no return...

  • ThomasM Profile Picture
    20 on at
    RE: How to create Item tracking line from C/AL

    I created this function to make use of the whole NAV Standard logic. NAV takes care for me to use the correct Lot:

    LOCAL PROCEDURE SalesOrderLineReserve@1000000012(VAR pioSalesLine@1000000000 : Record 37;piItem@1000000001 : Record 27);
        VAR
          lReservationEntry@1000000010 : Record 337;
          lReservEntryILE@1000000009 : Record 337;
          lReservEntryEdit@1000000008 : Record 337;
          lSalesLine@1000000006 : Record 37;
          lcuReservationManagement@1000000004 : Codeunit 99000845;
          DoFullReserve@1000000003 : Boolean;
          lcuSalesLineReserve@1000000002 : Codeunit 99000832;
        BEGIN
          lcuReservationManagement.SetSalesLine(pioSalesLine);
          lcuReservationManagement.AutoReserve(DoFullReserve, pioSalesLine.Description, WORKDATE, pioSalesLine."Outstanding Quantity", pioSalesLine."Outstanding Qty. (Base)");
          lcuSalesLineReserve.FilterReservFor(lReservationEntry,pioSalesLine);
    
          IF lReservationEntry.FINDSET THEN
            REPEAT
              lReservEntryILE.GET(lReservationEntry."Entry No.", NOT lReservationEntry.Positive);
              lReservEntryEdit.GET(lReservationEntry."Entry No.", lReservationEntry.Positive);
              lReservEntryEdit."Lot No." := lReservEntryILE."Lot No.";
              lReservEntryEdit.MODIFY;
            UNTIL lReservationEntry.NEXT = 0;
        END;


  • Community Member Profile Picture
    on at
    RE: How to create Item tracking line from C/AL

    Hi. I'm trying to do this too but in item journal to make a negative adjustment. Is it possible with CU 99000830? Could you post what functions should I use? 

    Best regards. 

  • ThomasM Profile Picture
    20 on at
    RE: How to create Item tracking line from C/AL

    Hey, can you tell which functions you used to solve your problem?

    Thanks in advance,

    Thomas

  • Community Member Profile Picture
    on at
    RE: How to create Item tracking line from C/AL

    Thanks for the reply

    My issue is solved and I made use of then functions in CU 99000845 Reservation management which again makes use of 99000832 Sales Line-Reserve.

  • Nareshwar Raju Vaneshwar Profile Picture
    5,596 on at
    RE: How to create Item tracking line from C/AL

    In my scenario, I had to auto-generate the Lot Tracking Code based on the date and job number. Codeunit 99000830 is what I used and it does the job!!

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,140 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,895 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans