Reverse Payment that already applied to Invoice

RikarddoRikarddo Member Posts: 70
Hi all,

I'm trying to reverse automatically a payment to a Vendor using these steps.
Step 1) Unapply the payment from the invoice
Step 2) Reverse out the transaction.

Step 1 i have no problems.

When i try to reverse automatically Payment of a Vendor, i'm getting this error:
LOCAL InsertFromGLEntry(VAR TempRevertTransactionNo : TEMPORARY Record Integer;Number : Integer;RevType : 'Transaction,Register';VAR NextLineNo : Integer)
TempRevertTransactionNo.FINDSET;
REPEAT
  IF RevType = RevType::Transaction THEN
    GLEntry.SETRANGE("Transaction No.",TempRevertTransactionNo.Number);
   // GLEntry.SETFILTER("Entry No.",'<>%1',0);
  IF GLEntry.FINDSET THEN
    REPEAT
      CLEAR(ReversalEntry);
      IF RevType = RevType::Register THEN
        ReversalEntry."G/L Register No." := Number;
      
      ReversalEntry."Reversal Type" := RevType;
      ReversalEntry."Entry Type" := ReversalEntry."Entry Type"::"G/L Account";
      ReversalEntry."Entry No." := GLEntry."Entry No.";
      IF NOT GLAcc.GET(GLEntry."G/L Account No.") THEN 
       ERROR(Text009,GLEntry.TABLECAPTION,GLAcc.TABLECAPTION);

Where
Text009 The transaction cannot be reversed, because the %1 has been compressed or a %2 has been deleted.

I know that i can manually reverse it using General Journal by
1) Debit Bank Acccount
2) Credit Vendor Account

But why i'm getting that error?

Thanks in advance

Answers

  • txerifftxeriff Member Posts: 340
    edited 2020-10-20
    well, it looks like it can´t do the get so check if the account still exists. (GLEntry."G/L Account No.")
Sign In or Register to comment.