[Event Request] Codeunit 5802 "Inventory Posting To G/L" - procedure PostInvtPostBufProcessGlobalInvtPostBuf()
Hi there,
I would like to ask for a new publisher in the codeunit 5802 "Inventory Posting To G/L", procedure PostInvtPostBufProcessGlobalInvtPostBuf(). We need to modify records in own tables after posting with use of "G/L Entry No.". It means we need also to get a return value GLEntryNo from standard procedure PostGenJnlLine(). The same subscriber is i.e. in standard codeunit 90 "Purch.-Post", in procedure PostInvoicePostBufferLine() in former implementation of posting, event is called OnAfterPostInvPostBuffer(). Or in new CU 826 "Purch. Post Invoice Events", event is called OnPostLinesOnAfterGenJnlLinePost(). Thank you.
codeunit 5802 "Inventory Posting To G/L"
{
...
local procedure PostInvtPostBufProcessGlobalInvtPostBuf(var GenJnlLine: Record "Gen. Journal Line"; var ValueEntry: Record "Value Entry"; PostPerPostGrp: Boolean)
var
IsHandled: Boolean;
begin
...
with TempGlobalInvtPostingBuffer do
repeat
...
if not CalledFromTestReport then
if not RunOnlyCheck then begin
...
OnBeforePostInvtPostBuf(GenJnlLine, TempGlobalInvtPostingBuffer, ValueEntry, GenJnlPostLine);
//PostGenJnlLine(GenJnlLine); // COMMENTED OUT
GLEntryNo := PostGenJnlLine(GenJnlLine); // NEW, INSTEAD OF A PREVIOUS LINE
OnAfterPostInvtPostBuf(GenJnlLine, TempGlobalInvtPostingBuffer, ValueEntry, GenJnlPostLine, GLEntryNo); // NEW EVENT
...
until Next() = 0;
end;
// RETURN VALUE IS ADDED TO STANDARD PROCEDURE
procedure PostGenJnlLine(var GenJnlLine: Record "Gen. Journal Line"): Integer
begin
//GenJnlPostLine.RunWithCheck(GenJnlLine); // COMMENTED OUT
exit(GenJnlPostLine.RunWithCheck(GenJnlLine)); // NEW, INSTEAD OF A PREVIOUS LINE
end;
// NEW EVENT
[IntegrationEvent(false, false)]
local procedure OnBeforePostInvtPostBuf(var GenJournalLine: Record "Gen. Journal Line"; var InvtPostingBuffer: Record "Invt. Posting Buffer"; ValueEntry: Record "Value Entry"; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line"; GLEntryNo: Integer)
begin
end;
}
That would be a breaking change. I'm adding the proposed OnAfterPostInvtPostBuf event, which contains the instance of GenJnlPostLine codeunit. In the subscriber you can call GenJnlPostLine.GetNextEntryNo, that should do the trick.
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.
Build ID: 18608.