Corrupt POs And Receipts In Both Work and Open

Microsoft Dynamics GPI had a client report a problem with a couple of purchase orders which were showing in the PO Entry window, but which they could not open. While looking into the problem we found three things:

  1. The problem was down to corruption where the PO was on both the work and open tables;
  2. There was more than just two POs;
  3. The problem also affected receipts.

Rather than trying to identify the problems manually, I wrote a SQL script which would identify all POs and Receipts which were on both the Work and Open tables:


CREATE TABLE #POCHECK(
	PONUMBER VARCHAR(20)
	,POPRCTNM VARCHAR(20)
	,CHCKDGIT INT
	,DCSTATUS INT
)
GO

INSERT INTO #POCHECK
	(PONUMBER,POPRCTNM,CHCKDGIT,DCSTATUS)
--VALUES
	(SELECT PONUMBER,'',1,1 FROM POP10100)
GO

INSERT INTO #POCHECK
	(PONUMBER,POPRCTNM,CHCKDGIT,DCSTATUS)
--VALUES
	(SELECT PONUMBER,'',1,3 FROM POP30100)
GO

INSERT INTO #POCHECK
	(PONUMBER,POPRCTNM,CHCKDGIT,DCSTATUS)
--VALUES
	(SELECT '',POPRCTNM,1,1 FROM POP10300)
GO

INSERT INTO #POCHECK
	(PONUMBER,POPRCTNM,CHCKDGIT,DCSTATUS)
--VALUES
	(SELECT '',POPRCTNM,1,3 FROM POP30300)
GO

SELECT
	PONUMBER
	,POPRCTNM
	,SUM(CHCKDGIT) AS DCCOUNT
FROM
	#POCHECK
GROUP BY
	PONUMBER,POPRCTNM
HAVING
	SUM(CHCKDGIT) > 1
GO

DROP TABLE #POCHECK
GO

After we used the script to identify the corrupt orders, it was a case of going through the returned records and correcting errors.

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 “Corrupt POs And Receipts In Both Work and Open

  1. Will Perkinson says:

    After identifying the records, how did you resolve the issue?

    1. Ian Grieve says:

      After identifying the documents, we determined which table they should be in and did some careful deletes (in test first to verify we didn’t cause problems).

Leave a Reply

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