This is a reposting of an article I originally wrote on my Developing for Dynamics GP blog.
In a recent newsgroup posting, I was helping a Visual Studio Tools developer whose users were receiving the following message when they went to exit Microsoft Dynamics GP.
Background process is running: Exit Aborted
There is a common cause for this error which is highlighted in the Visual Studio® Tools for Microsoft Dynamics™ GP Programmer’s Guide, Chapter 9: Working with Tables, in the section called Opening and closing tables. Below is an excerpt from the manual on the subject:
There is no explicit “open” operation for a table in Visual Studio Tools. The first time a table buffer is accessed, the table is automatically opened. The table buffer remains open until it is closed.
When your integrating application’s code has finished working with a global table buffer, it must be closed using the Close() method for the table. Failing to close a global table buffer will cause a “Background process is running: Exit Aborted” error when the user attempts to exit Microsoft Dynamics GP.
What this means is that if your code references a table at the global level, a table buffer will be created for you and will not be closed until your code specifically requests it to close with the Close() method. You must use the Close() method before the table object is destroyed (either explicitly or because the the scope no longer exists).
It is recommended to have exception handling around the table access code which will ensure that the Close() method is called even if an error occurs, see examples below:
Note: Form level table buffers will be closed automatically when the form is closed and so do not need an explicit command.
The situation in the newsgroup post was that another error generated by the code prevented the Close() method from being executed and so left the table buffer open and so caused an error when the user went to exit the application.
Post a comment to let me know find this information helpful.
This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on http://www.winthropdc.com/blog.