Dynamics GP – How to Unapply a Payables Invoice in HISTORY that’s applied to a OPEN Credit Document


I often see this request via support so thought I’d document it on my blog. The question varies however it usually goes something like this:

“I’ve accidentally applied an invoice to a Payment and now I need to unapply this however when I select the Payment in the “Transactions > Purchasing > Apply Payables Document” window the Invoice isn’t available to unapply? How can I unapply the invoice?”

The issue here is the “Apply Payables Document” window only shows OPEN documents and as the invoice has been fully applied its now in HISTORY. Therefore you can’t unapply it via this window.

Please note if both documents were in OPEN you could use the “Transactions > Purchasing > Apply Payables Documents” window to unapply it.

The solution in summary

Unfortunately there’s no easy way to unapply the invoice in this situation.

The fix I often suggest is to apply a dummy transaction to the payment so that it’s also transferred to HISTORY. You can then void the payment, which will unapply the Invoice.

Therefore, in summary, the steps would be:

  1. Post a dummy invoice (or debit note) for the amount remaining on the payment.
  2. Apply the dummy invoice to the payment which will send the payment to HISTORY.
  3. Void the payment via “Transactions > Purchasing > Void Historical Transactions”. This will unapply the Invoice.
  4. Void the dummy invoice via “Transactions > Purchasing > Void Open Transactions”
  5. Post the voided Payment back onto the system.

Detailed solution with an example

I’ve also described the scenario and solution in detail below.

Invoice INV123 has been accidentally applied to Payment 20069 when it should have been applied to Payment 20070. As a consequence Invoice INV123 is in HISTORY but Payment 20069 is still in OPEN meaning the invoice can’t be easily unapplied

This image has an empty alt attribute; its file name is image.png

To fix this we first post a dummy invoice for $80.00 (the remaining amount of payment 20069):

Next we apply this to the Payment via “Transactions > Purchasing > Apply Payables Documents”:

Now the Payment and invoices all show in History:

Next we void the payment via “Transactions > Purchasing > Void Historical Transactions”

Invoice INV123 is now showing as unapplied (as is the dummy invoice):

We now void the dummy invoice via “Transactions > Purchasing > Void Open Transactions”

And finally post the payment back onto the system

Once this has been done you can go ahead and apply invoice INV123 to the correct payment.


Although there are many steps to unapply the invoice using this process, it does provide a way of unapplying the invoice.

I hope this helps someone in the future.

Thanks for reading!

Dynamics GP – Error message “Unhandled script exception: SCRIPTS – data area” opening the Payables Enquiry window

I’m come across this error a few times so thought I’d document on my blog.

The user is presented with the below error when opening the “Enquiry > Purchasing > Transaction by Document” window in Dynamics GP

When the window does open there’s a blank record showing in the scrolling window:

When you expand the window and attempt to select it you are prompted with the message “The selected record has been deleted by another user” and it disappears from the window

In this particular instance the issue is being caused by an incorrect PM Keys Record in the PM00400 table.

If I search for an incomplete record in the PM00400 table using the SQL query below this returns one record:


If I then remove this record using the DELETE statement below the error no longer occurs when I open the window

* Always ensure you have adequate backups prior to deleting data from SQL


Please note you could also delete the entire contents of the PM00400 table and have the system recreate it using checklinks however this isn’t practical in my case.

I hope this helps anyone who encounters this issue in future.

Thanks for reading!

Dynamics 365 Business Central – Posting a Payables invoice to multiple GL codes using a Purchase Journal


As I learn and familiarise myself with Dynamics 365 Business Central I often post something in Dynamics GP and then wonder how this same task could be achieved in Dynamics 365 Business Central.

Today’s pondering was looking for the equivalent to the “Payables Transaction Entry” window that we have in Dynamics GP.

I know you can post to G/L accounts via the “Purchase Invoice” page in Dynamics 365 Business Central but to me this is primarily a “Purchase Order Processing” type window. I wanted to post a sundry payables invoice, onto a vendor, to multiple GL codes, without the need to touch the “Purchase Invoice” window.

As usual there is more than one way to do this however I focus on the “Purchase Journal” page. I also elude to why I think you can achieve the same using other “journal” pages, although you might not necessarily want to use those anyway 🙂

Dynamics GP – Payables Transaction Entry

In Dynamics GP you can post a sundry payables invoice in a very straight forward and easy to understand window called “Payables Transaction Entry”.

This window has no link to Purchase Order Processing. We tend to advise users to use this window for posting invoices for sundry items and things you wouldn’t necessarily have a Purchase Order for. You can click “Distributions” and record multiple GL codes for this one invoice. Its also handy to import transactions into very quickly and users seem to prefer this window for speed of entry.

Dynamics 365 Business Central – Purchase Journal

There are various “journal” pages in Dynamics 365 Business Central so I turned to the “Purchase Journal” page to achieve my goal.

The first thing I found I had to select was the option “Show more columns” as per below.

Crucially this adds the “Account Type” option which gives the user the ability to add “G/L Account” when keying in the Payables document:

Now I had the “Account Type” field available for entry I found as long as you keep the Document Number, External Document No and Posting Date the same you are able to add a payables document with multiple lines.

First you add the “Account Type” of “Vendor” and key in the first line with the total amount of the document. On the subsequent lines you can choose “G/L Account” as the account type and enter the G/L distribution breakdown. Also, if you wish to analyse tax to any of the distributions you must populate the “Gen. Posting Type” with “Purchases” and then populate the “VAT Prod. Posting Group”.

In the end you should have something like this and the document will post successfully

Other takeaways

As with any investigation you usually find some interesting things along the way.

The major takeaway I found is that you can post the same purchase invoice using the “General Journal” page. After looking more closely it seems this is possible as both pages are based on the “Gen. Journal Line” table. Therefore all the fields (and business logic) you need are available on the “General Journal” page as well.

See below. The “Purchase Journal” and “General Journal” pages are based on the same table:

Purchase Journal
General Journal

However, as a word of caution, if you were to post the same purchase invoice from the “General Journal” page the transaction is given a “Source Document” of “GENJNL” in the “G/L Register” rather than “PURCHJNL”.

See below. The top G/L Register was posted using the “General Journal” page and the other using the “Purchase Journal” page.

Therefore I’d suspect its best to use the specific “Purchase Journal” for these postings.

Thanks for reading!