The Purchase Header does not exist

jsinisajsinisa Member Posts: 27
Hi all,
in last few months some of our subsidiaries using NAV 5.0 facing strange problem during "Purchase Order" posting.
After Order is posted sometime pops-up error message that "The Purchase Header does not exist" referring to the Order just posted.
It happens once in 8-10 orders without any rule in it.

Posting is correct, it is first annoying, but after couple of error message colleague making postings have to restart client, because NAV Client hangs.

I have even try to "finish" Codeunit 90 process using Debugger starting after line with DELETE. Best I can get is to come to "Purchase Order" Form - OnFindRecord from where pops-up error message and that's it.
Setting Debugger active helped neither.

Also, strange thing in "Purchase Order" Form is that sometime after entering some data, somewhere in Form, some fields are stay blue (as selected), cursor is not visible anymore and is very hard to follow which field is active. Going to field with the mouse helps, but still is cursor not visible. What could then happen, is that posting is done, new Purchase Order is shown - problem is gone. ](*,)

I've spent lot of time doing Google and I couldn't find anything similar in NAV 5.0. Similar problem is mentioned in Navision 3.60 and solved with one BugFix.

What to do?

Comments

  • David_SingletonDavid_Singleton Member Posts: 5,479
    Is this post or post&print.

    I have seen something similar to this in sales and the issues related to some filters set whilst printing. Sorry I can't remember the details but if its it post and print, take a look at how the report is called. It might relate to the printer selection code especially if you are running on Citrix.
    David Singleton
  • jsinisajsinisa Member Posts: 27
    It was only post.
    Colleagues where I have tested have DocuWare and they don't print.

    We are using a template at our subs and I've asked other about this error. Three more subs have the same problem, eight don't have the problem. Same object stand. :shock:
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    As David suggested, there may be a filter set on posted document..

    In the process of posting complete invoice,it will delete the document .
    check whether there is a customization after that,..
  • FDickschatFDickschat Member Posts: 380
    I have encountered the exact same problem at a customer with both sales and purchase documents. It is usually a combination of 3 Errors:
    - The document does not exist (this is the document you just posted and which no longer exists)
    - Do you want to rename the record?
    - The document does not exist (same doc as in 1)

    The source of the problem is global variables in the subform which after posting still contain the old record in combination with a bug in NAV.

    It usually happens when forms are in fullscreen and when the cursor is in the lines when posting starts. It never happens when the cursor is in the header and usually does not happen when the forms are not in fullscreen but you cannot be sure of the latter. The error is not coming from the posting CU but happens when the form is refreshed (actually the subform).

    It works like this (when posting the cursor is in the lines):
    • CU 91 runs through without any errors.
    • When coming back from CU91 NAV starts to refresh the form. Rec and xRec are still the old deleted document (A) - No Error
    • The OnFindRecord Trigger finds the record to be displayed. Rec changes to an existing record (B). xRec is still (A) - No Error
    • OnAfterGetRecord clears a filter on document type (which was not existing on Rec). Rec is (B), xRec is now also (B) - No Error
    • In the next steps the Information Pane is updated (No. of Order Addresses, No. of Contacts,No. of Comments...) In all cases I checked Rec and xRec and they were always (B) - No Error
    • Custom Code: The Color of some fields is changed. Rec and xRec are (B) - No Error
    • After the last line of code from the Header was executed and NAV starts executing code from the subform the Error occurs: "Rec (A) does not exist"! The Error occurs exactly when pressing F8 in the debugger on the last line of header code

    The Error does not occur if the cursor is in the header when posting.

    The first line of code executed in the subform is
    "Type := xRec.Type;" in OnNewRecord. You could think that Rec in the lines is not correctly updated but this is not true.

    Actually someone added a global var "PurchHeader" to the subform (which is not even used in the OnNewRecord Trigger) and that var still points to the old record (A). For whatever reason this is enough for NAV to throw the error (if the cursor was in the subform when posting).

    How to fix it:
    Easy, just delete one by one the global vars from the subform and compile. Replace all occurences with local vars. Only if this is not possible leave them as global. For most of them it is and the developer was just too lacy to use local vars instead of globals.

    /Frank
    Frank Dickschat
    FD Consulting
Sign In or Register to comment.