Import Item Tracking Serial Numbers

JLkf_UkJLkf_Uk Member Posts: 6
edited 2012-10-04 in NAV Three Tier
Hi,

I have a request for importing item tracking serial numbers from an excel spreadsheet using a new function in the Item tracking lines Form. I searched the forum and found that the only way is to import the Serial Nos to new entries in the reservation entry table. My problem is that when i import the lines from the Item Tracking Form i have an error "Another user has modified the record" because when this form starts it locks the reservation entries table. #-o Anyone has developed this?

Thanks in advanced

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    I'm affraid we need a little more info.

    The Item Tracking part is by far the worst design part of Navision and hard to make changes to.

    Where do you want to assign these? In the manufacturing process? Or Purchassing? What is the Form number, and what code did you write?
  • JLkf_UkJLkf_Uk Member Posts: 6
    Hi Mark,

    Sorry i should have posted more info. The process is to import Serial Nos from an excel spreadsheet to the Purchase Order Lines. The user must go to the Purch Order -> Line -> Item Tracking Lines and open form 6510. Then it should have a function (in functions button) called "Import Tracking Lines" that should create the tracking lines from the specified spreadsheet. Excel spreadsheet will have only one column "Serial No.", quantity will always be 1.

    Thank you
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    "Another user has modified the record after it has been read" has nothing to do with locking.

    Can you share the code that you have created?

    It has been ages since I've worked with reservations, but maybe reading the code it will ring a bell.
  • JLkf_UkJLkf_Uk Member Posts: 6
    Hi Mark,

    I have a function at F6510 Item Tracking Lines that calls a reports to write the serial numbers to the reservation entry table. But when F6510 is closed this standard code runs:

    F6510 Item Tracking Lines
    WriteToDatabase()
    
    IF CurrentFormIsOpen THEN BEGIN
      TempReservEntry.LOCKTABLE;
      IF NOT TempRecIsValid THEN
        ERROR(Text007);
    

    This error is returned:

    Microsoft Dynamics NAV Classic
    Another user has modified the item tracking data since it was retrieved from the database.
    Start again.
    OK
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    I don't think form 6510 is a good place for this modification.

    It's by far the most dramatically designed form in Navision ever.

    I would create a new codeunit with the purchase line as parameter that creates the reservation entries, completely skipping the code in form 6510.

    This does require thourough knowledge of the reservation engine.
  • davmac1davmac1 Member Posts: 1,283
    As Mark wrote, form 6510 does not provide the table tracking lines - but has some "dramatic" logic.
    I wrote a codeunit to create reservation entries that is called by web services. You should look at existing tracking lines created for the various scenarios you wish to support.
    Receipts and shipments can be generated from multiple places and the data in the corresponding entries will vary accordingly.
  • JLkf_UkJLkf_Uk Member Posts: 6
    Thank you both for the suggestions. I do agree and will remove the functionality of this form, lets hope the customer will accept it :?
  • awarnawarn Member Posts: 261
    I have done a lot of work in this area (lots of item tracking customizations - don't get jealous!) in the past few years.

    You may want to use the Create Reserv. Entry codeunit, and the two functions CreateReservEntry.CreateReservEntryFor & CreateReservEntry.CreateEntry.

    Basically, by calling those two functions, you can properly create an item tracking line for an document. In the following example, we are automatically creating an item tracking line for the full quantity of the purchase line. It might not match exactly what you need, but if you allowed the user to enter or import many item tracking details per documetn line, you woudl just loop this code changing the quantity, lot & serial. It then creates the reservation entry properly.


    CreateReservEntry.CreateReservEntryFor(DATABASE::"Purchase Line",
    SubType,
    "Document No.",'',
    0,"Line No.","Qty. per Unit of Measure",
    "Quantity (Base)" - TrackingSpec."Quantity (Base)",
    '',{this is the serial number parameter}
    LotNo); //this field we figured out based on setup

    CreateReservEntry.CreateEntry("No.","Variant Code","Location Code",'',
    PurchHeader."Expected Receipt Date",0D,0,
    ResStatus);


    The problem with the item tracking form is that it is based on temporary tables, which group item ledgers together, and it makes it very hard to see what is going on until the form is clsoed, then the reservation engine lopps & groups and creates item tracking records. The other issue with this form is that you have to close it to go to the next line - if your customers use a lot of item tracking, this process becomes unuable, especially during inventory selection. Imagine a 20 line sales order, with 5 different lots being selected per sales line. You go to the line, open item tracking, open select entries, selct a few lines, close that form, close item tracking, and repeat TWENTY times. We ended up building some different screens to avoid the item tracking windows, but we still used a great deal of their code, it was simply too complex to start from scratch.
Sign In or Register to comment.