Codeunit 7307 Whse.-Activity-Register Code() trigger hangs

DeSpDeSp Member Posts: 105
Consider Codeunit 7307 Whse.-Activity-Register. Its trigger Code()'s execution sometimes leads to a Navision client hang. Here is the code:
Code():
.............
  // Register lines
  SourceCodeSetup.GET;
  LineCount := 0;
  IF RECORDLEVELLOCKING THEN
    WhseActivLine.LOCKTABLE;
  IF WhseActivLine.FIND('-') THEN BEGIN
    CreateRegActivHeader(WhseActivHeader);
    REPEAT
      LineCount := LineCount + 1;
      IF NOT HideDialog THEN BEGIN
        Window.UPDATE(3,LineCount);
        Window.UPDATE(4,ROUND(LineCount / NoOfRecords * 10000,1));
      END;
      IF Location."Bin Mandatory" THEN
        RegisterWhseJnlLine(WhseActivLine);
      CreateRegActivLine(WhseActivLine);
    UNTIL WhseActivLine.NEXT = 0;
  END;
...........

Everytime code execution hangs on the different steps - lines of the REPEAT/UNTIL statement.
We use Navision 3.70A and It is a default code - we haven't done any customizations there.
What is the cure?

Any suggesions would be very much appreciated.

Thanks in advance.
Nil desperandum

Comments

  • i4tosti4tost Member Posts: 208
    I will sugest some actions to do. First one - run database test.
    Have you tried on different PCs? If you are using server, try to create backup and run on local PC.
    I feel that you have some problem with PS hardware :(
  • DeSpDeSp Member Posts: 105
    Yes, we use the SQL 2k Server to run the database and this issue appears in the multi-user environment and on different PC's. I couldn't repeat it on the local PC.
    Nil desperandum
  • kinekine Member Posts: 12,562
    It means, on Native server is no problem and on MS SQL server is?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DeSpDeSp Member Posts: 105
    No, kine, I mean I used the db locally on one PC - single-user mode. We don't use the Native server - we use the SQL Server. Have you already met this issue with the Native server?
    Nil desperandum
  • kinekine Member Posts: 12,562
    I think, that it can be the problem of MS SQL, when sometime is not able to find some entry (it seems like the entry is for MS SQL "invisible" - you can see it when you apply all filters manually, but in the code the NEXT will not find it etc.). Solution for this kind of problem can be the to set diagnostics property on MS SQL by executing this SQL query:
    UPDATE [$ndo$dbproperty] SET diagnostics = 131072
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DeSpDeSp Member Posts: 105
    kine, I 've already had this value there - you helped me with it about several months ago. :) So, I guess, unfortunately, it is not the cure for this issue.
    Nil desperandum
  • kinekine Member Posts: 12,562
    Ah, sorry... :-) I forgot...;-)

    Ok, than it seems that problem is somewhere in this lines:
            RegisterWhseJnlLine(WhseActivLine);
          CreateRegActivLine(WhseActivLine);
    

    if it is neverending loop, it seems, like the WhseActivLine is modified somewhere in this functions and it corrupt the loop (like change of filtered field etc...)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DeSpDeSp Member Posts: 105
    if it is neverending loop, it seems, like the WhseActivLine is modified somewhere in this functions and it corrupt the loop (like change of filtered field etc...)

    It seems like all is correct. The loop is not corrupted.
    Nil desperandum
  • kinekine Member Posts: 12,562
    And did you check, that in case of "freezing" isn't the user locked by another user? (waiting for lock, "blocked" in session table)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DeSpDeSp Member Posts: 105
    Yes, I checked it - the user wasn't locked (blocked) by anyone.
    Nil desperandum
  • AlbertvhAlbertvh Member Posts: 516
    Hi DeSP

    Perhaps there is a bug in the standard coding because as I see it in the following code
    WITH WhseActivHeader DO BEGIN
      WhseActivLine.SETRANGE("Activity Type",WhseActivLine."Activity Type");
      WhseActivLine.SETRANGE("No.",WhseActivLine."No.");
      WhseActivLine.SETFILTER("Qty. to Handle",'<>0');
    

    should this range not be set to the WhseActivHeader record

    ie
    WITH WhseActivHeader DO BEGIN
      WhseActivLine.SETRANGE("Activity Type",[color=indigo]WhseActivHeader[/color]."Activity Type");
      WhseActivLine.SETRANGE("No.",[color=indigo]WhseActivHeader[/color]."No.");
      WhseActivLine.SETFILTER("Qty. to Handle",'<>0');
    

    Just a suggestion :-k
  • DeSpDeSp Member Posts: 105
    I don't think its a bug.
    Nil desperandum
Sign In or Register to comment.