NAV2009: The Sales Header does not exist

I have lately received this error “The Sales Header does not exist” a couple of times in Navision 2009.

First I thought this was caused by a filter not being reset on the form – but I got wiser.
Suddenly I noticed a pattern.

I got the error every time I “played” with Sales Invoices / Sales Quotes in one company and then changed to another company. If I now tried to use Sales Invoice / Sales Quotes etc I received the error.

After trying using RESET, SELECTLATESTVERSION etc. – I figured out that Navision didn’t clear all values during the change. The Odd thing was that first I got the error; it keept anoying me until I deleted the user’s zup file.

So what to do?

I found out that if a record already exists in the Sales Header table, you will not get the error. So you can either keep an empty record in the table or add it when opening the form.

I don’t like empty records! So I went with the last solution and used some code similar to this:

SH.RESET;
SH.SETRANGE(SH."Document Type",SH."Document Type"::Quote);
IF SH.COUNT = 0 THEN BEGIN
  SH."Document Type" := SH."Document Type"::Quote;
  SH.INSERT(TRUE);
END;

The code was added on OpenForm on Form 41 “Sales Quote”. Similar code was also added to the forms 42 “Sales Order”, 43 “Sales Invoice” and 44 “Sales Credit Memo”.

After this I did not get the error anymore 🙂

2 Comments

  1. I got an error that Sales Header already exist. No. series is already set to automatic and the Sales Order Number moves one number faster than the number series. What is the causes? Seems like it a bug. We are using Nav 3.7, hope you can assist on this.

    Thanks

  2. Hi Serena.

    How do you create a Sales Header? Manually?

    Have there been done any customizations to the Sales Header table?

    This sounds like a commit is missing and thereby the number is been given twice to a Sales Header.

    Also it could be a locking issue – so that if the Number has been taken by the Sales Header, the Number Series cannot be updated.

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.