Skip to content

[Event Request] Codeunit 10837 "Payment Management FR" - PostInvPostingBuffer #29982

@STaillandier

Description

@STaillandier

Why do you need this change?

On Payment Lines, user can set a reason code if SEPA payment is returned unpaid (new field in extension). This reason code should be saved in generated customer ledger entries during posting process.

With existing events :

  • We can transfer reason code from Payment Line to InvPostingBuffer (OnGenerInvPostingBufferOnBeforeUpdtBuffer)
  • We can transfer reason code from General Journal Line to Customer Ledger Entry (base App)

but we can't transfer value from InvPostingBuffer to General Journal Line

Describe the request

In procedure PostInvPostingBuffer(), we need to adjust existing code line 1096

local procedure PostInvPostingBuffer(): Integer
begin

[....]
GenJnlLine."Source No." := InvPostingBuffer[1]."Source No.";
GenJnlLine."External Document No." := InvPostingBuffer[1]."External Document No.";
GenJnlLine."Due Date" := InvPostingBuffer[1]."Due Date";
GenJnlLine."Shortcut Dimension 1 Code" := InvPostingBuffer[1]."Global Dimension 1 Code";
GenJnlLine."Shortcut Dimension 2 Code" := InvPostingBuffer[1]."Global Dimension 2 Code";
GenJnlLine."Dimension Set ID" := InvPostingBuffer[1]."Dimension Set ID";

    OnPostInvPostingBufferOnBeforeGenJnlPostLineRunWithCheck(GenJnlLine, PaymentHeader, PaymentClass, PaymentLine);
    GenJnlPostLine.RunWithCheck(GenJnlLine);
    GLEntry.SetRange("Document Type", GenJnlLine."Document Type");
    GLEntry.SetRange("Document No.", GenJnlLine."Document No.");
    if GLEntry.FindLast() then
        exit(GLEntry."Entry No.");
    exit(0);
end;

We need :

Either ajust current event by adding a parameter InvPostingBuffer[1] in OnPostInvPostingBufferOnBeforeGenJnlPostLineRunWithCheck

GenJnlLine."Dimension Set ID" := InvPostingBuffer[1]."Dimension Set ID";

OnPostInvPostingBufferOnBeforeGenJnlPostLineRunWithCheck(GenJnlLine, PaymentHeader, PaymentClass, PaymentLine, InvPostingBuffer[1]); // NEW PARAMETER
GenJnlPostLine.RunWithCheck(GenJnlLine);

with publisher :
OnPostInvPostingBufferOnBeforeGenJnlPostLineRunWithCheck(var GenJnlLine: Record "Gen. Journal Line"; var PaymentHeader: Record "Payment Header FR"; var PaymentClass: Record "Payment Class FR"; PaymentLine: Record "Payment Line FR"; InvPostingBuffer : record "Payment Post. Buffer FR")

Either add a new publisher before posting

GenJnlLine."Dimension Set ID" := InvPostingBuffer[1]."Dimension Set ID";
OnAfterCopyGenJnlLineFromInvPostingBuffer(GenJnlLine, InvPostingBuffer[1]); // NEW LINE

OnPostInvPostingBufferOnBeforeGenJnlPostLineRunWithCheck(GenJnlLine, PaymentHeader, PaymentClass, PaymentLine);
GenJnlPostLine.RunWithCheck(GenJnlLine);

with publisher :
OnAfterCopyGenJnlLineFromInvPostingBuffer(var GenJnlLine: Record "Gen. Journal Line"; InvPostingBuffer : record "Payment Post. Buffer FR")

Internal work item: AB#636051

Metadata

Metadata

Assignees

No one assigned

    Labels

    FinanceGitHub request for Finance areaevent-requestRequest for adding an event

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions