VendPostApplyVendLedgEntry - PostDtldVendLedgEntries - OnPostDtldVendLedgEntriesOnBeforePostDtldVendLedgEntry
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
Hello @kvmAlio, Please be more specific. What parameters do you want passed to OnPostDtldVendLedgEntriesOnBeforePostDtldVendLedgEntry? You mention LedgEntryInserted, are there any others?
For our use case, it's enough with "LedgEntryInserted"
Thanks.
Availability update: We will publish a fix for this issue in the next update for release 26.
Build ID to track: 37673.