Skip to main content

Notifications

Announcements

No record found.

Reverse G/L Entries from Check Ledger Entries — Dynamics NAV

As per the last post, I wrote about a workaround to post multiple G/L account entries per check. You can check it here.

While writing code for this process, I had to manually reverse all the entries which got posted.

img 1image 1a.

 

Check the image 1a, in here after posting all the entries, when reversing, Only the Payment Journals will be reversed, but not the associated General Journals, which is, by the way, the original entries.

I opened up Page 374, Check Ledger Entries, Page Action “Void Check”.
Before it financially voids the check, I wrote my code in upfront to reverse all the associated original entries.

I used the standard reversal code, with slight modifications.


// Associated Entries will have a reference to the Original Entry which is "Original Journal Doc No."
glEntry.SETRANGE(glEntry."Original Journal Doc No.", "Document No.");
glEntry.SETRANGE(glEntry.Reversed, FALSE);
IF NOT glEntry.FINDSET THEN
BEGIN
  EXIT;
END
ELSE
BEGIN
  CLEAR(ReversalEntry);
  IF glEntry.Reversed THEN
    ReversalEntry.AlreadyReversedEntry(TABLECAPTION, glEntry."Entry No.");
  IF glEntry."Journal Batch Name" = '' THEN
    ReversalEntry.TestFieldError;
  glEntry.TESTFIELD(glEntry."Transaction No.");
  ReversalEntry.ReverseTransaction(glEntry."Transaction No.");
END;

glEntry is a record of Table 17.

After this change, I encountered the long usual COMMIT error, because there is a Page.RUNMODAL on financial voiding of the check after reversal.

Captureimage 2b.

 

So I had to write a COMMIT on Table 179, Reversal Entry, function ReverseEntries().

After this change, the code worked swiftly.



This was originally posted here.

Comments

*This post is locked for comments