Purchase Invoice Lines cannot be deleted !

dlauwersdlauwers Member Posts: 127
NAV 4.0 sp3 SQL

Hello,

When we enter a Purchase Invoice and add some Purchase Invoice Lines we cannot delete the last line. We must start with the top line. When we try to delete the second or third line...

We get the error:
Another user has modified the record for this Purchase Line after you retrieved it from the database.

But there was no change made by any user !! I am testing this alone. Even closing the form and reopening it does not help.

I recompiled the table and some codeunits that where called, but that did not make any difference.
I tried to debug and find what went wrong ? The error is trown when the table is deleting the record, after the OnDelete Trigger has run its last line of code. I tried to figure out the code in between the delete trigger on the Pruchase Line Subform and the actual delete of the record in the table, but it is a lot of code. And no modification have been made to Purch Line Table or codeunits called in the process.

When we start deleting the first line, than this line is deleted and the others move 1 position up. Then you can again delete the first line, etc... until all lines are deleted.

But ofcourse, as tested in Cronus database you must be able to delete the other lines as well even if they are not at the first position !

I recompiled all, but this does not help.

Any idea's what could be wrong ? :-k

Thank
Danny

Answers

  • WaldoWaldo Member Posts: 3,412
    Are there customization done on the objects?

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • dlauwersdlauwers Member Posts: 127
    No direct objects are changed regarding these purchase Lines


    But I have found the following with further testing...
    I have restored the same backup in a SQL and in a native database. Both databases where created as NEW and then a full restore was done.

    In the restore in the SQL database I get the described error.
    In the restore in the Native DB everything works OK.

    This is ](*,)

    When I activate Cronus on SQL, the same error occurs !!

    It seems that this is only in the SQL version ??

    I am running SQL 2005 SP1.

    It occurs on 2 different SQL 2005 systems (XP + Windows 2003)

    Can someone test this to see if they have the same issue ??!!

    Just go to Purchase invoice in cronus (SQL) add some lines, and try to delete the last one.

    Thanks
    Danny
    [-o<
  • kinekine Member Posts: 12,562
    There are differences between version control system on SQL and Native, but in general it seems that the process is not correctly written and same record is modified through two variables where one change is nested between reading and modification.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • WaldoWaldo Member Posts: 3,412
    Have you tried it with SP3?

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • kinekine Member Posts: 12,562
    Waldo wrote:
    Have you tried it with SP3?

    See first line of first post... :-)

    (I just hope that it is DB version, not just client version... ;-))
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • WaldoWaldo Member Posts: 3,412
    kine wrote:
    Waldo wrote:
    Have you tried it with SP3?

    See first line of first post... :-)

    (I just hope that it is DB version, not just client version... ;-))

    Damn, you're right ... :oops: .

    The "SQL Server 2005 SP1" probably got me confused #-o

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • dlauwersdlauwers Member Posts: 127
    It is NAV 4.0 SP3. (Client + DB)

    I am now installing SQL 2005 SP2 (Final) Release 19/02/07 to see if that would fix something ?

    But it takes a long time to install +1h on a fast machine...

    I'll test some more and report back.

    Danny

    P.S. If all tests fail, is there a way to contact MS about this, maybe via call logging tool on partnersource ?
  • dlauwersdlauwers Member Posts: 127
    1) Finaly SQL 2005 SP2 finished installing, I have tested again but with the same result.

    2) I took a Virtual PC with XP and SQL 2005 SP1 installed. I installed a fresh copy of Navision 4.0 SP3 on it and attached the demo database of Cronus on it. I opened the SQL Navision Client and opened the SQL database and Cronus company. I tried to do the same thing and I got an error as described in this post.

    What else can I try ](*,)

    There is no real workarround that deleting all the lines, or delete the first line and then again the first line until the line you wanted to delete is gone.

    I guess this is a bug :bug: in NAV 4 SP3 SQL ?!

    Are there hotfixes available ?

    Time to report this to MS...

    Thanks
    Danny
  • WaldoWaldo Member Posts: 3,412
    dlauwers wrote:
    Time to report this to MS...

    I'm afraid so ...

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • dlauwersdlauwers Member Posts: 127
    Microsoft provided a hotfix for the problem, everything is working correctly now. \:D/

    It is a small change in form 55. In the OnUpdate Trigger add CurrForm.UPDATE(TRUE); before the RecalcAllLines.

    For more details request Hotfix Ref. 22232

    Danny
  • WaldoWaldo Member Posts: 3,412
    Thanks, Danny!

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • WaldoWaldo Member Posts: 3,412
    I ran into this problem today, and the solutions wasn't described entirely correct.

    This is what I did in Form 55:
    In the OnDeleteRecord trigger, add the CurrForm.UPDATE after the RecalcAllLines.
    That would make your code in that trigger like this:
    IF PurchSetup."Show Totals on Purch. Inv./CM." THEN BEGIN
      IF NOT Done THEN BEGIN
        CurrForm.SETSELECTIONFILTER(SelectedPurchLine);
        IF SelectedPurchLine.FIND('+') THEN;
        Done := TRUE;
      END;
      IF ("Line No." = SelectedPurchLine."Line No.") THEN BEGIN
        RecalcAllLines;
        MakeTotals;
        Done := FALSE;
        CurrForm.UPDATE(TRUE);  //*** Added Line
      END;
    END;
    IF (Quantity <> 0) AND ItemExists("No.") THEN BEGIN
      COMMIT;
      IF NOT ReservePurchLine.DeleteLineConfirm(Rec) THEN
        EXIT(FALSE);
      ReservePurchLine.DeleteLine(Rec);
    END;
    

    But as you can see, thanks to your description, I found the solution rather quick :) .

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
Sign In or Register to comment.