Background process is running: Exit Aborted message

David Meego - Click for blog homepageThis 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:

C# Code Example

RmCustomerMstrTable CustomerMasterTable;
CustomerMasterTable = Dynamics.Tables.RmCustomerMstr;

// Read the first row of the table

// Display the name for the row retrieved
catch(Exception e)
// Close the table buffer


VB Code Example

Dim CustomerMasterTable As RmCustomerMstrTable
CustomerMasterTable = Dynamics.Tables.RmCustomerMstr

‘ Read the first row of the table

‘ Display the name for the row retrieved


‘ Close the table buffer
End Try


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

3 thoughts on “Background process is running: Exit Aborted message

  1. Thanks for the post David.  I was doing some testing with VS Tools reading GP table objects, and came across the Exit Aborted message.
    Sure enough, I was not closing the table in my test code!


  2. I don't know enough programming to understand how to make use of this post.
    to make the buyer id auto populate onto a wennsoft (key 2 act) purchase order screen I have run up against this exit aborted.
    the post notes that all id's have to be buyer ids otherwise you will be prompted to add the buyer.  This adding of the buyer is then presumably causing this exit aborted.
    How do I modify the code to get around the error?
    Private Sub BuyerID_BeforeGotFocus(CancelLogic As Boolean)
    Dim usrinfObj As UserInfo
    Dim usrID As String
    Set usrinfObj = VbaGlobal.UserInfoGet()
    usrID = usrinfObj.UserID
    BuyerID = usrID End Sub
    any help is appreciated!


Please post feedback or comments

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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