Microsoft SQL Server 2008
--
Questions
--
Followers
Top Experts
I'm new to GP and trying to assist a company in resolving certain discrepancies. Â With the current issue, processing refunds works like this:
1) Â Final bills are processed in Cogsdale (integrated solution to GP for billing )
2) Â A batch is made for the refunds
3) Â Once a week refunds are sent to accounts payable (AP) for checks to be cut. Â These records will end up in Great Plains in order for the checks to be cut.
4) Â In the process of sending a batch to AP the error below was fired
5) Â The process was stopped
How can I go about troubleshooting this? Â I would like to find out which check is causing the problem. Â That is, which record made it over to the GP side and at the same time is still considered part of the batch to process.
I would think the only way a resolution could come is to find the problem record. Â That way the correct questions could be asked. Â Is there a way to turn on logs or something of this nature that would assist here?
Thanks !!
duplicate-key-error.JPG
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
I created a test database and table that would not accept duplicates. Â I then started a trace and attempted to add duplicate data on the primary key.
The picture below shows the trace catching it but I don't see anything that associates this with a Primary Key Violation. Â This is the error I get within Microsfot Management Studio:
Msg 2627, Level 14, State 1, Line 1
Violation of PRIMARY KEY constraint 'PK_TestTable'. Cannot insert duplicate key in object 'dbo.TestTable'.
The statement has been terminated.
You would expect the same thing within the trace and then hopefully the exact values being passed, right?
How do I see this information?
Thanks!
One question: Â Does Cogsdale prepare the refunds and then send them directly to AP?
Or does Cogsdale first sent the refunds as credits to the AR module, and then you use the GP Refunds Checks feature to send the refunds to the AP module?
If Cogsdale is sending the refunds directly to GP, then I believe you are seeing a classic AP voucher integration issue. Â If not, then you can ignore the rest of this post and we'll have to come up with a new strategy to troubleshoot.
Assuming you have a direct AP integration, let's start with the error message, which is actually two errors. Â
The first error message is telling you that something is trying to insert a "duplicate key" (a duplicate value) in the PM10000 table. Â The key is set in the "PKPM10000" index, which is a composite index that includes the following fields:
BCHSOURC Â (Batch source)
BACHNUMB Â (Batch number)
VCHNUMWK Â (Voucher number)
If you attempt to insert a record into PM10000 with values for these 3 fields, and there is already a record in PM10000 with the same values for those three fields, you will get that primary key error. Â This is really caused by a duplicate voucher number.
Based on my experience integrating hundreds of thousands of payables invoices, this problem is due to at least one poor design choice in the integrating application. Â
The integrating app is likely attempting to use the Payables Setup table to get the next voucher number from GP. Â Although this would seem to be sensible, it is fraught with complications, and invariably you will get this error. Â Due to some whacky weirdness that GP does when it issues voucher numbers to users, it is simply not possible for an external application to reliably get the next voucher number directly from the PM00400 table (by reading the table, getting the next voucher number, incrementing the number, and then updating the table with the new next number). Â It may work 95% of the time, but you will eventually run into this problem if you are importing very many vouchers.
The second error is the PKPM00400 error, which is related to the PM00400 table (PM Key Master File). Â This table keeps a copy of every document number that was issued out of Payables. Â
Since the integration is attempting to insert a duplicate document number into PM10000, it is no surprise that it is also attempting to insert a duplicate documnet number into PM00400. Â
The quick fix for this problem is to have all users close any Payables windows, especially the Payables Transaction Entry window, where voucher numbers are issued.
Then open the Payables Setup window (Dynamics GP -> Tools -> Setup -> Purchasing -> Payables), click on the Options button, and then change the Next Voucher Number to increase it to a new number that has not been used yet.
Click on OK to save the change and close all windows.
In general, this problem will occur whenever users have a Payables Transaction Entry window open, and you try and run the AP invoice integration.
The integration can be designed to avoid this error, but would require the external application to be modified.
Let me know if this makes sense.
Thanks,
Steve Endow
Dynamics GP Certified Trainer
Dynamics GP Certified Professional






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Good stuff! Â Could you explain this process one more time:
--------------------------
The integrating app is likely attempting to use the Payables Setup table to get the next voucher number from GP. Â Although this would seem to be sensible, it is fraught with complications, and invariably you will get this error. Â Due to some whacky weirdness that GP does when it issues voucher numbers to users, it is simply not possible for an external application to reliably get the next voucher number directly from the PM00400 table (by reading the table, getting the next voucher number, incrementing the number, and then updating the table with the new next number). Â It may work 95% of the time, but you will eventually run into this problem if you are importing very many vouchers.
--------------------------
When you got to, "...get the next voucher number directly...." Â What is it about the read on the table (by the integrating app) that is not synchronized?
That's what I'm missing. Â Thanks!
John
Thanks!
You guys ! Â Between the two of you I was able to take a good look at this. Â Thanks!
Again thanks.
We attempted (quick fix) to increment the Next Voucher Number. Â However, it wasn't something they could just look at or consider and choose to back out. Â They couldn't get out of the dialog and also were unable to pull any transactions up. Â The A/P side shows batches with the correct number of transactions in it.
Any comments here?
Thanks
But, I can not get out of the screen you wanted me to go to even with Control/ Alt Delete.(GP>Tools>Setup>Pur
I had Jenny look at the A/P side and it show batches with the correct number of transactions in it but no transactions will pull up????

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
:|
Is there an error message or dialog that appears when you try and close the Options window? Â Or is GP completely unresponsive or did it hang?
Normally the Options window should not require any values to be changed, and you should be able to close the window by clicking on the X in the upper right, or the OK button.
And is it the Options window that you can't close, or is the the Payables Management Setup window that won't close?
Thanks,
Steve Endow
Dynamics GP Certified Trainer
Dynamics GP Certified Professional
It was the Payables Management Setup window.
One of our consultants logged in and corrected the 'freeze' but I don't know what that correction was. Â The user attempted to close the window by using the X in the upper right. Â I'm not sure but this user may have felt forced to enter a value and therefore did not want to select OK.
The consultant is aware of fix and is handling this issue. Â I just figured I'd pick your brain for as much as I could until something came to a head.
Thanks!






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
There is already a stored procedure for this called taGetPMNextPaymentNumber! All you need to do is call it.
Are you saying that the Payables Management Setup window will trigger this stored procedure to increment the voucher number?
The user was getting an error message similar to, "Invalid entry...." Â In other words, they Window could not be X'd out of, but maybe it could have been OK'd out of. Â Either way, you are saying that the user does not have to generate the number manually - they system will do it by calling the taGetPMNextPaymentNumber()
The Payables Management Setup window - right? Â
taGetPMNextPaymentNumber is an eConnect stored procedure that can be called by an external application that needs to integrate / import payables transactions into GP.
Last I checked, which was a few years ago, the GP voucher window has it's own separate stored procedure that it calls to get the next voucher number.
The Payables Setup Options window simply SETS the next number. Â It does not get the next number--that is done during data entry, or during transaction import.
My point is that if your Cogsdale application is trying to get the next voucher number without using taGetPMNextPaymentNumber, then that is likely the cause of the occasional error that you are seeing.
Thanks,
Steve Endow
Dynamics GP Certified Trainer
Dynamics GP Certified Professional
How about taking a look at this one regarding an 'sa' password change and the affect on GP
https://www.experts-exchange.com/questions/26173531/How-to-change-the-sa-password-in-GP.html
Thanks!

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Microsoft SQL Server 2008
--
Questions
--
Followers
Top Experts
Microsoft SQL Server 2008 is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning. Major improvements include the Always On technologies and support for unstructured data types.