Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 59438

Corrupt POs And Receipts In Both Work and Open

$
0
0

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)GOINSERT INTO #POCHECK(PONUMBER,POPRCTNM,CHCKDGIT,DCSTATUS)--VALUES(SELECT PONUMBER,'',1,1 FROM POP10100)GOINSERT INTO #POCHECK(PONUMBER,POPRCTNM,CHCKDGIT,DCSTATUS)--VALUES(SELECT PONUMBER,'',1,3 FROM POP30100)GOINSERT INTO #POCHECK(PONUMBER,POPRCTNM,CHCKDGIT,DCSTATUS)--VALUES(SELECT'',POPRCTNM,1,1 FROM POP10300)GOINSERT INTO #POCHECK(PONUMBER,POPRCTNM,CHCKDGIT,DCSTATUS)--VALUES(SELECT'',POPRCTNM,1,3 FROM POP30300)GOSELECT
	PONUMBER,POPRCTNM,SUM(CHCKDGIT) AS DCCOUNTFROM
	#POCHECKGROUP BY
	PONUMBER,POPRCTNMHAVINGSUM(CHCKDGIT)> 1GODROP TABLE #POCHECKGO

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


Viewing all articles
Browse latest Browse all 59438

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>