Hi
We had a dealer report and error in our "Suggest Vendor Payments" report. He basically got the error message;
"Payable Vendor Ledger Entry already exists. Identification fields blah blah".
At first I was sure we had made a grave mistake somewhere but then I managed to produce the exact same error in a Standard NAV 2009 SP1.
What you do is the following:
go to Vendor 20000 and Block him for payment.
Start a Payment Journal and activate: "Suggest Vendor Payments". Now assuming that you have due vendor ledger entries on Vendor 20000 and that they are within the filter of your report you will get an error:
"You cannot create this type of document blah blah".
Now press OK and run "Suggest Vendor payments" again. Now you get the error;
"Payable Vendor Ledger Entry already exists. Identification fields blah blah".
Why?
As far as I can see the RTC does NOT clear the contents of temporary tables correctly. If you put ""Payable Vendor Ledger Entry.DELETEALL" in the "Vendor - OnPreDataItem" trigger everything starts working again.
Just a FYI and if you could confirm that the same error exists in your environment I would appreciate it. If this is a known issue and I am just being stupid about something I would very much appreciate a heads up on that as well.
Comments
Cheers
Craig
What I suspect is happening (as you have suggested above) is that the PayableVendLedgEntry (a temp table) is not being cleared. Even when the report is closed and re-run.
In Vendor OnAfterGetRecord you will find PayableVendLedgEntry.DELETEALL;
If this does not run (i.e. there is an error prior to OnAfterGetRecord being run), you'd expect the table to be destroyed after the report goes out of scope. i.e. it should have the same effect as having run PayableVendLedgEntry.DELETEALL;
But it does not.
For the time being I am just adding PayableVendLedgEntry.DELETEALL; in the OnPreReport trigger and I'll refer onto Microsoft.
Cheers
Craig
I'm having trouble with this myself now and on a customers machine.
Having a look at the table in this instance I can see that there is already no data in it. Went into SQL and did:
select * from MYDATABASE.dbo.[CRONUS UK Ltd_$Payable Vendor Ledger Entry]
This is showing the table as empty before the system is even looking at this. I did try to add the line
PayableVendLedgEntry.DELETEALL;
to the report 393 at the top make sure the table is cleared out and it didn't help.
Still getting this error message and unable to suggest vendor payments. Any ideas on this.
I've been looking at this and have finally with a colleague of mine discovered the issue. The table PayableVendLedgEntry is getting locked by the NAV service, if you turn the NAV service off and back on again and clear out the current list of sugested payments the suggest button will work again. So on looking for a better way than having the customer get all his users to leave NAV and restarting the service every time this happens, we found a line of code very similar to Craig.S's
PayableVendLedgEntry.RESET;
We put it in the same place at the begining of the 393 report and although you have to leave Payment Journals and go back in again, it does allow you to re-run the report without the error message. You do still need to delete all lines in the payment Batch before re-running.
I can't help think that there is a better way of dealing with this locked table in the code, we are not programmers but implementor and support, so if any C/AL pros out there can see a better way please update this thread :-)
We've tried everything suggested in this thread but none of it has worked for us so far. Hopefully someone might have another suggestion soon though...
Vendor "XYZ" suggested vendor payment of $100,000 ($50,000 and $50,0000).
Payment journal line was left at $100,000.00
Applied entries where done only to $80,000.00 (50,000 on one line and 30,000 on the other line), Balance = $20,000
Then they posted it. The unapplied entries stayed in limbo and prevent the payment journal from running again until those entries where cleared.