{"title":"Codeunit 2679 Purchase Alloc. Acc. Mgt., extension points 29","url":"https://jonas-paprotka.de/ref/codeunit/2679-purchase-alloc-acc-mgt/points/","author":"JOP-AL","license":"Metadata from Microsoft's symbol packages. AL source MIT, Copyright (c) Microsoft Corporation. Selection and wording © 2026 JOP-AL. https://jonas-paprotka.de/licenses/","subject":"Microsoft Dynamics 365 Business Central","checked":"2026-11-20","changed":"2026-10-05","object":{"type":"codeunit","id":2679,"name":"Purchase Alloc. Acc. Mgt.","app":"Base Application","url":"https://jonas-paprotka.de/ref/codeunit/2679-purchase-alloc-acc-mgt/"},"major":29,"source":{"url":"https://jonas-paprotka.de/ref/codeunit/2679-purchase-alloc-acc-mgt/source/","path":"src/Layers/W1/BaseApp/Finance/AllocationAccount/Purchase/PurchaseAllocAccMgt.Codeunit.al","commit":"4303e5e584d3aa5d9e98cbc615525a5396ad6ed7","lines":"a line is <source url>#L<line>"},"steps":{"event":"[line, \"event\", name, handled]: raises an event of this object; handled 1 when it has an IsHandled parameter","call":"[line, \"call\", name, arguments]: calls a procedure of this object","ext":"[line, \"ext\", type, id, name, arguments]: calls a procedure of another object, through a variable declared with that type","write":"[line, \"write\", table id, method, 1 when called with true]: Insert, Modify, ModifyAll, Delete, DeleteAll or Rename","validate":"[line, \"validate\", table id, field name]","run":"[line, \"run\", type, id]: Codeunit.Run, Page.Run, Report.Run and their kin"},"objects":{"table:39":{"name":"Purchase Line","url":"https://jonas-paprotka.de/ref/table/39-purchase-line/"},"codeunit:2675":{"name":"Allocation Account Mgt.","url":"https://jonas-paprotka.de/ref/codeunit/2675-allocation-account-mgt/"},"table:2672":{"name":"Allocation Line","url":"https://jonas-paprotka.de/ref/table/2672-allocation-line/"},"codeunit:2676":{"name":"Alloc. Acc. Telemetry","url":"https://jonas-paprotka.de/ref/codeunit/2676-alloc-acc-telemetry/"},"table:2673":{"name":"Alloc. Acc. Manual Override","url":"https://jonas-paprotka.de/ref/table/2673-alloc-acc-manual-override/"},"codeunit:2674":{"name":"Alloc. Acc. Handle Doc. Post","url":"https://jonas-paprotka.de/ref/codeunit/2674-alloc-acc-handle-doc-post/"},"codeunit:1720":{"name":"Deferral Utilities","url":"https://jonas-paprotka.de/ref/codeunit/1720-deferral-utilities/"},"codeunit:408":{"name":"DimensionManagement","url":"https://jonas-paprotka.de/ref/codeunit/408-dimensionmanagement/"},"codeunit:415":{"name":"Release Purchase Document","url":"https://jonas-paprotka.de/ref/codeunit/415-release-purchase-document/"},"table:38":{"name":"Purchase Header","url":"https://jonas-paprotka.de/ref/table/38-purchase-header/"}},"procs":[{"name":"GetOrGenerateAllocationLines","line":30,"kind":"procedure","access":"internal","params":4,"steps":[[41,"ext","table",39,"GetPurchHeader",0],[44,"call","LoadManualAllocationLines",2],[46,"call","GetAllocationAccount",2],[47,"ext","codeunit",2675,"GenerateAllocationLines",6],[48,"ext","codeunit",2675,"SplitQuantitiesIfNeeded",3],[49,"call","ReplaceInheritFromParent",2]]},{"name":"LoadManualAllocationLines","line":53,"kind":"procedure","access":"internal","params":2,"steps":[[73,"event","OnLoadManualAllocationLinesOnBeforeInsertAllocationLine",0],[74,"write",2672,"Insert"]]},{"name":"ReplaceInheritFromParent","line":78,"kind":"procedure","access":"local","params":2,"steps":[[94,"write",2672,"ModifyAll"],[98,"write",2672,"ModifyAll"]]},{"name":"HandlePostDocument","line":109,"kind":"procedure","access":"local","params":6,"steps":[[114,"call","VerifyLinesFromDocument",2],[118,"ext","codeunit",2676,"LogPurchaseInvoicePostingUsage",0],[119,"call","CreateLinesFromDocument",1]]},{"name":"HandleAfterCheckSalesApprovalPossible","line":137,"kind":"procedure","access":"local","params":1,"steps":[[141,"call","VerifyLinesFromDocument",2],[151,"call","CreateLinesFromDocument",1]]},{"name":"CheckBeforeModifyLine","line":157,"kind":"procedure","access":"local","params":3,"steps":[[159,"call","VerifyPurchaseLine",1],[160,"call","DeleteManualDistributionsIfLineChanged",1]]},{"name":"HandleValidateLineNo","line":164,"kind":"procedure","access":"local","params":4,"steps":[[176,"call","VerifyPurchaseLine",1]]},{"name":"DeleteManualDistributionsIfLineChanged","line":184,"kind":"procedure","access":"local","params":1,"steps":[[193,"call","AllocationAccountUsed",1],[217,"write",2673,"DeleteAll"]]},{"name":"CreateLinesFromDocument","line":225,"kind":"procedure","access":"local","params":1,"steps":[[230,"call","CheckPurchaseReleaseStatus",2],[235,"call","CreateLines",1],[236,"write",39,"DeleteAll"],[242,"call","CreateLines",1],[243,"write",39,"DeleteAll"],[245,"call","CheckPurchaseReleaseStatus",2]]},{"name":"CreateLines","line":248,"kind":"procedure","access":"local","params":1,"steps":[[257,"call","CreateLinesFromAllocationAccountLine",1]]},{"name":"CreateLinesFromAllocationAccountLine","line":266,"kind":"procedure","params":1,"steps":[[277,"call","GetAllocationAccount",2],[280,"call","VerifyAllocationAccount",1],[282,"call","GetOrGenerateAllocationLines",2],[290,"call","GetNextLine",1],[293,"call","GetLineIncrement",3],[296,"call","GetLastLine",1],[308,"call","GetDescriptionChanged",3],[311,"call","CreatePurchaseLine",6],[314,"call","FixQuantityRounding",3],[315,"call","DeleteManualOverrides",1]]},{"name":"DeleteManualOverrides","line":318,"kind":"procedure","access":"local","params":1,"steps":[[326,"write",2673,"DeleteAll"]]},{"name":"VerifyLinesFromDocument","line":329,"kind":"procedure","access":"local","params":2,"steps":[[340,"call","VerifyPurchaseLines",1],[352,"call","VerifyPurchaseLines",1]]},{"name":"CreatePurchaseLine","line":357,"kind":"procedure","access":"local","params":6,"steps":[[366,"ext","codeunit",2674,"SetVATBusPostingGroupCode",1],[369,"ext","codeunit",2674,"SetVATProdPostingGroupCode",1],[372,"validate",39,"No."],[374,"validate",39,"Tax Group Code"],[384,"call","MoveAmounts",4],[385,"call","MoveQuantities",2],[389,"call","CopyDeferralSchedule",2],[390,"call","TransferDimensionSetID",3],[394,"event","OnBeforeCreatePurchaseLine",0],[396,"write",39,"Insert",1],[399,"call","RedistributeQuantitiesIfNeededMoveQuantities",4]]},{"name":"CopyDeferralSchedule","line":403,"kind":"procedure","access":"local","params":2,"steps":[[421,"ext","codeunit",1720,"CreateCopyOfDeferralSchedule",2]]},{"name":"RedistributeQuantitiesIfNeededMoveQuantities","line":439,"kind":"procedure","access":"local","params":4,"steps":[[449,"ext","table",2672,"GetQuantityPrecision",0],[452,"ext","table",39,"IsInvoiceDocType",0],[453,"validate",39,"Quantity"],[453,"ext","table",2672,"GetQuantityPrecision",0],[455,"validate",39,"Quantity"],[456,"ext","table",2672,"GetQuantityPrecision",0],[457,"ext","table",2672,"GetQuantityPrecision",0],[458,"ext","table",2672,"GetQuantityPrecision",0],[459,"ext","table",2672,"GetQuantityPrecision",0],[460,"ext","table",2672,"GetQuantityPrecision",0],[461,"ext","table",2672,"GetQuantityPrecision",0],[462,"ext","table",2672,"GetQuantityPrecision",0],[463,"ext","table",2672,"GetQuantityPrecision",0],[464,"ext","table",2672,"GetQuantityPrecision",0],[465,"ext","table",2672,"GetQuantityPrecision",0],[466,"write",39,"Modify"]]},{"name":"FixQuantityRounding","line":469,"kind":"procedure","access":"local","params":3,"steps":[[544,"write",39,"Modify"]]},{"name":"MoveAmounts","line":547,"kind":"procedure","access":"local","params":4,"steps":[[556,"validate",39,"Direct Unit Cost"],[556,"call","GetUnitPrice",2],[557,"call","GetAmount",2],[560,"ext","codeunit",2675,"GetCurrencyRoundingPrecision",1],[561,"validate",39,"Direct Unit Cost"],[567,"validate",39,"Direct Unit Cost"]]},{"name":"GetAmount","line":572,"kind":"procedure","access":"local","params":2,"steps":[[578,"ext","table",39,"GetPurchHeader",0],[581,"ext","codeunit",2675,"GetCurrencyRoundingPrecision",1]]},{"name":"GetUnitPrice","line":588,"kind":"procedure","access":"local","params":2,"steps":[[593,"ext","table",39,"GetPurchHeader",0],[595,"ext","codeunit",2675,"GetCurrencyRoundingPrecision",1]]},{"name":"TransferDimensionSetID","line":679,"kind":"procedure","params":3,"steps":[[692,"ext","codeunit",408,"UpdateGlobalDimFromDimSetID",3],[701,"ext","codeunit",408,"GetCombinedDimensionSetID",3]]},{"name":"VerifyPurchaseLines","line":705,"kind":"procedure","access":"local","params":1,"steps":[[712,"call","VerifyPurchaseLine",1]]},{"name":"VerifySelectedAllocationAccountNo","line":721,"kind":"procedure","params":1,"steps":[[736,"call","VerifyAllocationAccount",1]]},{"name":"VerifyPurchaseLine","line":767,"kind":"procedure","access":"local","params":1,"steps":[[772,"call","AllocationAccountUsed",1],[775,"event","OnBeforeVerifyPurchaseLine",0],[777,"call","VerifySelectedAllocationAccountNo",1],[783,"call","VerifyAllocationAccount",1],[784,"ext","codeunit",2675,"VerifyNoInheritFromParentUsed",1]]},{"name":"CheckPurchaseReleaseStatus","line":788,"kind":"procedure","access":"local","params":2,"steps":[[793,"run","codeunit",415],[794,"write",38,"Modify"],[801,"ext","codeunit",415,"Reopen",1],[803,"ext","codeunit",415,"SetSkipCheckReleaseRestrictions",0],[804,"ext","table",38,"SetHideValidationDialog",1]]}]}