Announcements
Does anyone have a SQL script that will identify AP SQL script to look for orphaned records? I was using the AP Inquiry screen and noticed that several vendors cause this screen to crash. I suspect there are missing records in the AP tables.
Hi Richard,
Glad to hear the problem is resolved!
I ran check links after deleting the records from the PM00400 table. The remaining problem was the next payment number in AP setup had not gotten updated so when they went to enter a new manual payment it tried to use an existing number.
Hi Richard,
Here are some scripts I use to find invalid orphan records in payables:
SELECT * FROM PM00400 WHERE (DCSTATUS = 0 OR DCSTATUS = '' OR DOCTYPE = '' OR DOCTYPE = 0 OR DOCNUMBR = '' OR CNTRLNUM = '' OR VENDORID = '') AND DCSTATUS <> 1
SELECT * FROM PM10300 WHERE DOCTYPE = '' OR DOCTYPE = 0 OR VCHRNMBR= '' OR VENDORID = ''
SELECT * FROM PM10400 WHERE DOCTYPE = '' OR DOCTYPE = 0 OR VCHRNMBR= '' OR VENDORID = '' OR DOCNUMBR = ''
SELECT * FROM PM10100 WHERE VCHRNMBR = '' OR VENDORID = ''
SELECT * FROM PM20000 WHERE DOCTYPE = '' OR DOCTYPE = 0 OR VCHRNMBR= '' OR VENDORID = '' OR DOCNUMBR = ''
SELECT * FROM PM10200 WHERE DOCTYPE = '' OR DOCTYPE = 0 OR VCHRNMBR= '' OR VENDORID = '' OR APFRDCNM = '' OR APTODCNM = '' or APTVCHNM = ''
SELECT * FROM PM30200 WHERE DOCTYPE = '' OR DOCTYPE = 0 OR VCHRNMBR= '' OR VENDORID = '' OR DOCNUMBR = ''
SELECT * FROM PM30300 WHERE DOCTYPE = '' OR DOCTYPE = 0 OR VCHRNMBR= '' OR VENDORID = '' OR APFRDCNM = '' OR APTODCNM = '' or APTVCHNM = ''
SELECT * FROM PM30600 WHERE VCHRNMBR = '' OR VENDORID = ''
If there are records missing (like the PM00400 keys record – this is what I find is most commonly missing), it makes sense to run check links (in test) to let GP repopulate those for you.
Hope this helps!
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156