Breaking news from around the world
Get the Bing + MSN extension
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2019 release wave 2 Discover the latest updates and new features to Dynamics 365 planned through March 2020
Release overview guides and videos Release Plan | View virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Talent TechTalks | Upcoming TechTalks
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
You don't need to write in tempitemtracking, standard NAV "AS IS" write directly in table 337 "reservation entries" creating prospect lines for item tracking Handling.
just in time for you... a simple example:
Tracking C/AL code exampe that write in table 337 Reservation entries
//tbl83 "Item Journal Line" - LOOP on jornal line existing lines
rec83.SETRANGE("Journal Template Name" , 'ITEM') ; //filter template and batch
rec83.SETRANGE("Journal Batch Name", 'INV2016');
LotLine := 0;
IF rec83.FINDSET THEN
IF ItemHasLot(rec83."Item No.") THEN // function to check if item use LOTS
//Create Tracking record in table 337
rec337."Entry No." := MaxEntry337 +1; //recover MAX Entry No. from tbl 337
rec337."Reservation Status" := rec337."Reservation Status"::Prospect;
rec337."Creation Date" := WORKDATE;
rec337."Source Type" := 83;
rec337."Source Subtype" := 2;
rec337."Source ID" := 'ITEM';
rec337."Source Batch Name" := 'INV2016';
rec337."Source Ref. No." := rec83."Line No.";
rec337.Positive := TRUE;
rec337.VALIDATE("Location Code", rec83."Location Code") ;
rec337.VALIDATE("Bin Code", rec83."Bin Code");
rec337.VALIDATE("Item No.",rec83."Item No.");
rec337.VALIDATE("Quantity (Base)", rec83.Quantity);
rec337."Item Tracking" :=rec337."Item Tracking"::"Lot No." ; // IF LOT OR TRACKING in this sample LOT
LotLine := LotLine+=;
//Creation of LOT NO. if necessary to create a new one LOT
IF STRLEN(FORMAT(LotLine)) = 1 THEN
rec337."Lot No." := 'INV16-' + '00000' + FORMAT(LotLine) ;
IF STRLEN(FORMAT(LotLine)) = 2 THEN
rec337."Lot No." := 'INV16-' + '0000' + FORMAT(LotLine) ;
//OR USE CASE IF YOU HAVE MORE CASES TO HANDLE
IF rec337.INSERT(TRUE) THEN //If Write Tracking Line then Create LOT INFO Records
//Lot Info creation
recLotNoIInformation.VALIDATE("Item No.", rec337."Item No.");
recLotNoIInformation.VALIDATE("Lot No." , rec337."Lot No.");
UNTIL rec83.NEXT = 0;
i hope that cab be usefull...
you can use CU 99000830 "Create Reserv. Entry" functions CreateEntry, CreateReservEntry, CreateReservEntryFor, CreateReservEntryFrom.
on a note: I triede to find bind code in rec337 but I could not find I so I left out thist line
rec337.VALIDATE("Bin Code", rec83."Bin Code");
Is that a problem?
Also. Do you have an example on how to reserv from this reservation line from a sales order line?
This has really been a big help.
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!!
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.
Hey, can you tell which functions you used to solve your problem?
Thanks in advance,
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?
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);
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;
lcuReservationManagement.AutoReserve(DoFullReserve, pioSalesLine.Description, WORKDATE, pioSalesLine."Outstanding Quantity", pioSalesLine."Outstanding Qty. (Base)");
IF lReservationEntry.FINDSET THEN
lReservEntryILE.GET(lReservationEntry."Entry No.", NOT lReservationEntry.Positive);
lReservEntryEdit.GET(lReservationEntry."Entry No.", lReservationEntry.Positive);
lReservEntryEdit."Lot No." := lReservEntryILE."Lot No.";
UNTIL lReservationEntry.NEXT = 0;
Can you explain me this function better pls? There is no return...
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!
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
Business Applications communities