Table 39 "Purchase Line" runs several pieces of standard logic that an extension currently cannot skip or replace. In three places there is no event that lets a subscriber apply a custom condition and, when it is met, run its own logic instead of the standard call:
- In the
"Location Code"fieldOnValidatetrigger,PlanPriceCalcByFieldis always called for items when the location changes; there is no way to suppress it conditionally. - In
CopyFromItem,GetItemTranslationis always called when the purchase header has a language code; there is no way to skip it and run custom translation handling instead. - In
CheckWMS,CheckLocationOnWMSis always called whenCurrFieldNo <> 0; there is no way to suppress that warehouse check conditionally.
We need an extension point before each of these calls so subscribers can plug in custom handling in a supported, upgrade-safe way.
Add three new integration events to table 39 "Purchase Line", each raised before the
corresponding standard call and each using the IsHandled pattern so a subscriber that sets
IsHandled := true skips the standard call:
- Before
PlanPriceCalcByFieldin the"Location Code"OnValidatetrigger. Pass thePurchase Linerecord,IsHandled(var), the current field number, and thexPurchaseLinerecord. - Before
GetItemTranslationinCopyFromItem. Pass thePurchase Linerecord, theItemrecord, andIsHandled(var). - Before
CheckLocationOnWMSinCheckWMS. Pass thePurchase Linerecord, the current field number, andIsHandled(var).CheckWMSneeds a localIsHandled: Booleanvariable added.
Illustrative shape for one of the three (final event names and signatures must follow BC event conventions):
local procedure CheckWMS()
var
IsHandled: Boolean;
begin
IsHandled := false;
// new integration event raised here, passing Purchase Line, CurrFieldNo, and IsHandled (var)
if not IsHandled then
if CurrFieldNo <> 0 then
CheckLocationOnWMS();
// ...
end;- Table 39 "Purchase Line" is kept as a separate copy in many country/region layers. All three
events must be added consistently to every layer that keeps a copy of this table:
App/Layers/W1/BaseApp/Purchases/Document/PurchaseLine.Table.al- and the same file in the APAC, BE, CH, DACH, ES, FI, GB, IT, NA, NL, NO, RU, and SE layers.
- That is 14 layer copies in total, so exactly 14 files change.