Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Sales Header table vs Sales Header Archive table

Posted on by Microsoft Employee

I wrote an adhoc SQL statement joining the two tables on "No_" and noticed we have a little bit of overlap where the same sales document is present in both tables.  What are the conditions for a sales document to be archived? How can I see sales documents in both tables?

Also, what statuses are available to a sales document? Is this customizable? 

*This post is locked for comments

  • Suggested answer
    Alexander Ermakov Profile Picture
    Alexander Ermakov 28,094 on at
    RE: Sales Header table vs Sales Header Archive table

    I agree with other members here that normally you would not need to do this, as the archive represents just a momentary snapshot of certain sales order. You can have many copies of those if you need. Normally you would want to archive it before deleting just to keep copy of that. Also, you can setup automatic archiving ( msdn.microsoft.com/.../hh935230(v=nav.90).aspx ) if needed.

    What is the main reason you would need to join this two tables? What information you are trying to get from Sales Header Archive?

    As per your second question - you can read about Sales Header statuses here: https://msdn.microsoft.com/en-us/library/hh895848(v=nav.90).aspx . There are 4 default statuses, but you can customize your solution and add more if needed, or add additional field with more other statuses.

  • Suggested answer
    Alex A Profile Picture
    Alex A 2,348 on at
    RE: Sales Header table vs Sales Header Archive table

    The Sales Header Archive table can have many versions of the same Sales Order. The archiving function can occur when you manually archive the Sales Order by pushing the Archive button in the ribbon, or it can archive when you change Status of the Sales Order, or at other intervals. It simply takes a snapshot in time of your Sales Order. The most common need to manually archive a Sales Order would be if you needed to delete it - usually first you would archive it before deleting it just as a practice.

    In a production setting you probably wouldn't join these two tables together, but you might join in the Sales Header Archive table in combination with other tables depending on what you're trying to achieve. If you ever do need to do this, you would usually have to add some clever SQL to join only the latest archived version of the Sales Order with whatever other table you are needing to join it with. If you don't specify that you want the latest version of the archive table in your query, you will end up with multiple rows in your result. 

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Sales Header table vs Sales Header Archive table

    Hi.

    So, archiving is not necessarily to do with the processing of an order?  I don't full understand the reason for archiving.  Is it just to capture/version the document at certain points in time as things change on the document?  It sounds like you can continue to archive as much as you want during the life of a sales document.

  • Suggested answer
    Rabin Profile Picture
    Rabin 2,976 on at
    RE: Sales Header table vs Sales Header Archive table

    Hi,

    when ever you call function to Archive any Sales Order it keeps the current document with a Version. The next time you call archive again, it will keep the same document with another version in the Sales Order Archive document.

    So, in your case, there will be at least one key that will make each record in archive document unique and its VERSION.

    The Relation will be One to Many, since you can archive as many times you want.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans