ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

VendPostApplyVendLedgEntry - PostDtldVendLedgEntries - OnPostDtldVendLedgEntriesOnBeforePostDtldVendLedgEntry

Open kvmAlio opened this issue 1 year ago • 3 comments

Why do you need this change?

In codeunit 12 "Gen. Jnl.-Post Line", there is a functionality for customers, that is skipped for vendors. When "applying" entries to customer entries, if posting groups are different in the selected entries, the system automatically makes the required GL entry adjustments. This is thanks to this calls in the code:

codeunit 12 "Gen. Jnl.-Post Line", procedure CustPostApplyCustLedgEntry calls DtldLedgEntryInserted := PostDtldCustLedgEntries(GenJnlLine, TempDtldCVLedgEntryBuf, CustPostingGr, false);

And then in PostDtldCustLedgEntries there is a call to PostDtldCustLedgEntry(GenJnlLine, DtldCVLedgEntryBuf, CustPostingGr, AdjAmount); that makes the GL adjustments.

Now, if we go to the equivalent code in Vendors, we will see the same:

VendPostApplyVendLedgEntry calls DtldLedgEntryInserted := PostDtldVendLedgEntries(GenJnlLine, TempDtldCVLedgEntryBuf, VendPostingGr, false);

But in this case, the call is only made when ΓÇ£LedgerEntryInsertedΓÇ¥ is true:

if LedgEntryInserted then
                                        PostDtldVendLedgEntry(GenJournalLine, DetailedCVLedgEntryBuffer, VendPostingGr, AdjAmount);

This is a problem, because, as you can see, VendPostApplyVendLedgEntry calls PostDtldVendLedgEntries with this parameter to false

For us it doesnΓÇÖt make much sense, it should work exactly like in the customer functionality, or at least, we should have more flexibility. For example, in Customers, this event has more parameters than the Vendor counterpart, in this case, the option to modfy the ΓÇ£LedgEntryInsertedΓÇ¥ var:

OnPostDtldCustLedgEntriesOnBeforePostDtldCustLedgEntry(DtldCVLedgEntryBuf, AddCurrencyCode, GenJnlLine, CustPostingGr, AdjAmount, IsHandled, NextEntryNo, DtldCustLedgEntry, LedgEntryInserted);

OnPostDtldVendLedgEntriesOnBeforePostDtldVendLedgEntry(GenJournalLine, DetailedCVLedgEntryBuffer, VendPostingGr, AdjAmount, IsHandled);

Describe the request

For example, in Customers, this event has more parameters than the Vendor counterpart, in this case, the option to modfy the ΓÇ£LedgEntryInsertedΓÇ¥ var:

OnPostDtldCustLedgEntriesOnBeforePostDtldCustLedgEntry(DtldCVLedgEntryBuf, AddCurrencyCode, GenJnlLine, CustPostingGr, AdjAmount, IsHandled, NextEntryNo, DtldCustLedgEntry, LedgEntryInserted);

OnPostDtldVendLedgEntriesOnBeforePostDtldVendLedgEntry(GenJournalLine, DetailedCVLedgEntryBuffer, VendPostingGr, AdjAmount, IsHandled); Internal work item: AB#592254

kvmAlio avatar Jul 11 '25 10:07 kvmAlio

Hello @kvmAlio, Please be more specific. What parameters do you want passed to OnPostDtldVendLedgEntriesOnBeforePostDtldVendLedgEntry? You mention LedgEntryInserted, are there any others?

AndreasHans avatar Aug 01 '25 12:08 AndreasHans

For our use case, it's enough with "LedgEntryInserted"

Thanks.

kvmAlio avatar Aug 01 '25 15:08 kvmAlio

Availability update: We will publish a fix for this issue in the next update for release 26.

Build ID to track: 37673.

JesperSchulz avatar Aug 05 '25 07:08 JesperSchulz