Locked Payables Transaction: You cannot display this record while another user is editing it

Microsoft Dynamics GPWith sites using Microsoft Dynamics GP over Citrix Presentation or XenApp, where they have set Citrix to time users out after a certain period of inactivity, we occasionally see the following error message when another user tries to open the voucher in Payables Transaction Entry (Transactions » Purchasing » Transaction Entry);

This document number already exists. Please enter a new document number.

The problem occurs when a user has a transaction open in Payables Transaction Entry and doesn’t touch GP for a while, such as when they go to lunch or even home for the evening. We have repeatedly stressed to clients that they should close GP down when they leave their desk for a period of time, if only for security purposes along with locking their machine, but this is a battle we seem destined to lose.

If the user, who was locking the transaction, logs back into GP then the lock is automatically removed. But if the user doesn’t log back in before someone else tries to open the invoice they get the above error ad we get a call logged on the helpdesk.

The following SQL is what we have produced to quickly remove the lock entries from ACTIVITY in the system database and DEX_LOCK and DEX_SESSION in tempdb, change the value of the (highlighted) @VCHRNMBR variable to your Voucher Number;

SELECT * FROM tempdb..DEX_LOCK
SELECT * FROM tempdb..DEX_SESSION
SELECT * FROM DYNAMICS..ACTIVITY

DECLARE @Session_ID INT
DECLARE @VCHRNMBR VARCHAR(30)

SET @VCHRNMBR = '00000000000000460'

SET @Session_ID = (
SELECT
   session_id FROM tempdb..DEX_LOCK AS DEX_LOCK (*)
INNER JOIN
   PM10000 AS ['PM Transaction WORK File'] (*)
   ON ['PM Transaction WORK File'].DEX_ROW_ID = DEX_LOCK.row_id
WHERE
   ['PM Transaction WORK File'].VCHRNMBR = @VCHRNMBR
)

IF @Session_ID IS NOT NULL
   BEGIN
      DELETE FROM tempdb..DEX_LOCK WHERE session_id = @Session_ID

      IF (SELECT COUNT(*) FROM tempdb..DEX_SESSION AS DEX_SESSION (*) WHERE DEX_SESSION.session_id = @Session_ID) 0
         DELETE FROM tempdb..DEX_SESSION WHERE session_id = @Session_ID

      IF (SELECT COUNT(*) FROM dynamics..ACTIVITY AS ACTIVITY (*) WHERE ACTIVITY.SQLSESID = @Session_ID) = 0
         DELETE FROM DYNAMICS..ACTIVITY WHERE SQLSESID = @Session_ID
   END

As always with scripts be careful when running them; especially in this case make sure the user who is being removed really is not in the system. Once or twice when this was being logged, the user was still actively working on the voucher in question.

What should we write about next?

If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.

Your Name

Your Email

Suggested Topic

Suggestion Details

Looking for support or consultancy with Microsoft Dynamics GP?

I no longer work with Microsoft Dynamics GP, but the last company I worked for was ISC Software in the UK; if you’re looking for support or consultancy services with Microsoft Dynamics GP you can contact them here.

2 thoughts on “Locked Payables Transaction: You cannot display this record while another user is editing it

Leave a Reply

Your email address will not be published. Required fields are marked *