Error message when executing 'Ajust Cost - Item Entries'

LSANTOSLSANTOS Member Posts: 3
When I execute the ‘Adjust Cost – Item Entries’ routine in the Inventory Module the program gives the following error message:
“Another user has modified the record for this Item after you retrieved it from the database. Enter your changes again in the updated window, or start the interrupted activity again. Identification fields and values: No.=’010001’”

This message only occurs when I’m working with SQL database. When I execute the referred transaction with a native navision database I do not have any problem.

Is it a conflict in the sql database? Can anyone give me a clue on this matter?

Thank you in advance

Luis Santos

Comments

  • kinekine Member Posts: 12,562
    This seems that it is a bug. I sent it to MS but because I have no step-by-step reproduction doc. there is problem. But I found the point of wrong design in CU5895:
    In codeunit 5895 procedure MakeSingleLevelAdjmt() is this Code (part):
    REPEAT
      Window.UPDATE(2,ItemLedgEntry."Item No.");
    
      ItemLedgEntry.SETRANGE("Item No.",ItemLedgEntry."Item No.");
      GetCostingMethod(Item,ItemLedgEntry."Item No.",CostingMethod);    //1
      IF CostingMethod = CostingMethod::Average THEN BEGIN
        AdjustCostApplied(ItemLedgEntry."Item No.",TRUE);                 //2
        // Restart adjustment, if too many recursions
        WHILE LevelExceeded DO BEGIN
          LevelExceeded := FALSE;
          AdjustCostApplied(ItemLedgEntry."Item No.",TRUE);              //2
        END;
        AdjustAverage(ItemLedgEntry."Item No.");                               //2
      END ELSE BEGIN
        AdjustCostApplied(ItemLedgEntry."Item No.",FALSE);               //2
        // Restart adjustment, if too many recursions
        WHILE LevelExceeded DO BEGIN
          LevelExceeded := FALSE;
          AdjustCostApplied(ItemLedgEntry."Item No.",FALSE);           //2
        END;
      END;
    
        IF (CostingMethod <> CostingMethod::Standard) AND (Item."No." <> '') THEN 
          ItemCostMgt.UpdateUnitCost(Item,'','',0,0,TRUE,FALSE,FALSE);    //3
    
      ItemLedgEntry.FIND('+');
      ItemLedgEntry.SETRANGE("Item No.");
    UNTIL (ItemLedgEntry.NEXT = 0) OR LevelExceeded;
    

    Problem is that in line marked as //1 is filled the variable Item, on lines //2 are sometime called functions that change data on the item (but only item no. is passed) and on line //3 is Item variable modified = conflict, because between //1 and //3 was record changed in lines //2.

    Solution - change part with //3:
        IF (CostingMethod <> CostingMethod::Standard) AND (Item."No." <> '') THEN  BEGIN //Added BEGIN
          Item.GET(Item."No.");   //Refresh Item card
          ItemCostMgt.UpdateUnitCost(Item,'','',0,0,TRUE,FALSE,FALSE);
        END; //added END;
    

    We are using it without error now.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • LSANTOSLSANTOS Member Posts: 3
    Kine,

    thank you very much. It solved my problem.
  • ngebhardngebhard Member Posts: 127
    Hi everybody,

    we had the same problem using a SQL Server. We've got the answer that this seems to be a locktable-problem within SQL. MBS Support gave us some coding to fix the problem and it works as well (at least so far). The coding is the one that kine published at last but we didn't make any more changes. Maybe I should have a look at kine's coding as well... :)

    Best regards,
    N. Gebhard
    ProTAKT Projekte & Business Software AG
    Microsoft Dynamics NAV Partner
    Bad Nauheim, Germany
    http://www.protakt.de
    http://twitter.com/protakt
  • ngebhardngebhard Member Posts: 127
    One more thing, which I noticed while looking through the published coding of Kine:

    we were asked to use the code as it follows (didn't realize before that the line is "missing" in Kine's code).

    IF (CostingMethod <> CostingMethod::Standard) AND (Item."No." <> '') THEN BEGIN //Added BEGIN
    Item.LOCKTABLE; //ADD THIS LINE AS WELL
    Item.GET(Item."No."); //Refresh Item card
    ItemCostMgt.UpdateUnitCost(Item,'','',0,0,TRUE,FALSE,FALSE);
    END; //added END;


    We didn't have any error messages afterwards any more.
    Regards,
    N. Gebhard
    ProTAKT Projekte & Business Software AG
    Microsoft Dynamics NAV Partner
    Bad Nauheim, Germany
    http://www.protakt.de
    http://twitter.com/protakt
  • kinekine Member Posts: 12,562
    ngebhard, can I ask you from where you have this code? Was sent you from Microsoft?

    I want to know, because when I sent them this problem, there was no solution for me and I sent them my code. :-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ngebhardngebhard Member Posts: 127
    Hi Kine,

    one of our customers migrated from native DB to sql DB and afterwards the error which LSANTOS described occured. We started a mbs support request (partnersource) about it and some support engineer gave this code to us. But we didn't need to fill out this paper from mbs (with the 9 pages) though it might not be an official feedback from Denmark but only from the support engineer. Don't know for sure...


    Best regards,
    N. Gebhard
    ProTAKT Projekte & Business Software AG
    Microsoft Dynamics NAV Partner
    Bad Nauheim, Germany
    http://www.protakt.de
    http://twitter.com/protakt
  • kinekine Member Posts: 12,562
    If it is code from support incident it is for me same as official patch. I only want to track the way of the code. I created support incident 1.11.2004 (dd.mm.yyyy;-)) including this workaround. I communicated with Endre B. May be that it was first incident for that. When you wrote your incident, they took the workaround, make fine-tuning (the locking) and sent it to you... OK, I am happy that MS support is working in this way... ;-)

    I am posting this to show, how is MS support working and that you never know from where is the code... 8-[ :whistle:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • RobertMoRobertMo Member Posts: 484
    Kine I had similar experience, but it was related to localization. It's interesting that I communicated with Milan Schorovsky who is GTSC MBS Support Engineer in Prague! Maybe do you know him?
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Sign In or Register to comment.