{"title":"Codeunit 2678 Sales Alloc. Acc. Mgt., extension points 29","url":"https://jonas-paprotka.de/ref/codeunit/2678-sales-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":2678,"name":"Sales Alloc. Acc. Mgt.","app":"Base Application","url":"https://jonas-paprotka.de/ref/codeunit/2678-sales-alloc-acc-mgt/"},"major":29,"source":{"url":"https://jonas-paprotka.de/ref/codeunit/2678-sales-alloc-acc-mgt/source/","path":"src/Layers/W1/BaseApp/Finance/AllocationAccount/Sales/SalesAllocAccMgt.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:37":{"name":"Sales Line","url":"https://jonas-paprotka.de/ref/table/37-sales-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/"}},"procs":[{"name":"GetOrGenerateAllocationLines","line":29,"kind":"procedure","access":"internal","params":4,"steps":[[40,"ext","table",37,"GetSalesHeader",0],[43,"call","LoadManualAllocationLines",2],[45,"call","GetAllocationAccount",2],[46,"ext","codeunit",2675,"GenerateAllocationLines",6],[47,"ext","codeunit",2675,"SplitQuantitiesIfNeeded",3],[48,"call","ReplaceInheritFromParent",2]]},{"name":"LoadManualAllocationLines","line":52,"kind":"procedure","access":"internal","params":2,"steps":[[72,"event","OnLoadManualAllocationLinesOnBeforeInsertAllocationLine",0],[73,"write",2672,"Insert"]]},{"name":"ReplaceInheritFromParent","line":77,"kind":"procedure","access":"local","params":2,"steps":[[93,"write",2672,"ModifyAll"],[97,"write",2672,"ModifyAll"]]},{"name":"HandlePostDocument","line":107,"kind":"procedure","access":"local","params":5,"steps":[[112,"call","VerifyLinesFromDocument",2],[116,"ext","codeunit",2676,"LogSalesInvoicePostingUsage",0],[117,"call","CreateLinesFromDocument",1]]},{"name":"HandleAfterCheckSalesApprovalPossible","line":135,"kind":"procedure","access":"local","params":1,"steps":[[139,"call","VerifyLinesFromDocument",2],[149,"call","CreateLinesFromDocument",1]]},{"name":"CheckBeforeModifyLine","line":155,"kind":"procedure","access":"local","params":3,"steps":[[157,"call","VerifySalesLine",1],[158,"call","DeleteManualDistributionsIfLineChanged",1]]},{"name":"HandleValidateLineNo","line":162,"kind":"procedure","access":"local","params":4,"steps":[[174,"call","VerifySalesLine",1]]},{"name":"DeleteManualDistributionsIfLineChanged","line":182,"kind":"procedure","access":"local","params":1,"steps":[[191,"call","AllocationAccountUsed",1],[215,"write",2673,"DeleteAll"]]},{"name":"CreateLinesFromDocument","line":223,"kind":"procedure","access":"local","params":1,"steps":[[230,"call","CreateLines",1],[231,"write",37,"DeleteAll"],[237,"call","CreateLines",1],[238,"write",37,"DeleteAll"]]},{"name":"CreateLines","line":241,"kind":"procedure","access":"local","params":1,"steps":[[251,"call","CreateLinesFromAllocationAccountLine",1]]},{"name":"CreateLinesFromAllocationAccountLine","line":260,"kind":"procedure","params":1,"steps":[[271,"call","GetAllocationAccount",2],[274,"call","VerifyAllocationAccount",1],[276,"call","GetOrGenerateAllocationLines",2],[284,"call","GetNextLine",1],[287,"call","GetLineIncrement",3],[290,"call","GetLastLine",1],[302,"call","GetDescriptionChanged",3],[305,"call","CreateSalesLine",6],[308,"call","FixQuantityRounding",3],[309,"call","DeleteManualOverrides",1]]},{"name":"DeleteManualOverrides","line":312,"kind":"procedure","access":"local","params":1,"steps":[[320,"write",2673,"DeleteAll"]]},{"name":"VerifyLinesFromDocument","line":323,"kind":"procedure","access":"local","params":2,"steps":[[334,"call","VerifySalesLines",1],[346,"call","VerifySalesLines",1]]},{"name":"CreateSalesLine","line":351,"kind":"procedure","access":"local","params":6,"steps":[[360,"ext","codeunit",2674,"SetVATBusPostingGroupCode",1],[363,"ext","codeunit",2674,"SetVATProdPostingGroupCode",1],[366,"validate",37,"No."],[376,"call","MoveAmounts",4],[377,"call","MoveQuantities",2],[380,"call","CopyDeferralSchedule",2],[381,"call","TransferDimensionSetID",3],[385,"event","OnBeforeCreateSalesLine",0],[387,"write",37,"Insert",1],[390,"call","RedistributeQuantitiesIfNeededMoveQuantities",4]]},{"name":"CopyDeferralSchedule","line":394,"kind":"procedure","access":"local","params":2,"steps":[[412,"ext","codeunit",1720,"CreateCopyOfDeferralSchedule",2]]},{"name":"RedistributeQuantitiesIfNeededMoveQuantities","line":430,"kind":"procedure","access":"local","params":4,"steps":[[440,"ext","table",2672,"GetQuantityPrecision",0],[443,"validate",37,"Quantity"],[444,"ext","table",2672,"GetQuantityPrecision",0],[445,"ext","table",2672,"GetQuantityPrecision",0],[446,"ext","table",2672,"GetQuantityPrecision",0],[447,"ext","table",2672,"GetQuantityPrecision",0],[448,"ext","table",2672,"GetQuantityPrecision",0],[449,"ext","table",2672,"GetQuantityPrecision",0],[450,"ext","table",2672,"GetQuantityPrecision",0],[451,"ext","table",2672,"GetQuantityPrecision",0],[452,"ext","table",2672,"GetQuantityPrecision",0],[453,"ext","table",2672,"GetQuantityPrecision",0],[454,"write",37,"Modify"]]},{"name":"FixQuantityRounding","line":457,"kind":"procedure","access":"local","params":3,"steps":[[532,"write",37,"Modify"]]},{"name":"MoveAmounts","line":535,"kind":"procedure","access":"local","params":4,"steps":[[540,"validate",37,"Unit Price"],[540,"call","GetUnitPrice",2],[541,"call","GetAmount",2],[544,"validate",37,"Unit Price"]]},{"name":"GetUnitPrice","line":549,"kind":"procedure","access":"local","params":2,"steps":[[554,"ext","table",37,"GetSalesHeader",0],[557,"ext","codeunit",2675,"GetCurrencyUnitAmountPrecision",1]]},{"name":"GetAmount","line":561,"kind":"procedure","access":"local","params":2,"steps":[[567,"ext","table",37,"GetSalesHeader",0],[570,"ext","codeunit",2675,"GetCurrencyRoundingPrecision",1]]},{"name":"TransferDimensionSetID","line":647,"kind":"procedure","access":"local","params":3,"steps":[[660,"ext","codeunit",408,"UpdateGlobalDimFromDimSetID",3],[669,"ext","codeunit",408,"GetCombinedDimensionSetID",3]]},{"name":"VerifySalesLines","line":673,"kind":"procedure","access":"local","params":1,"steps":[[680,"call","VerifySalesLine",1]]},{"name":"VerifySelectedAllocationAccountNo","line":689,"kind":"procedure","params":1,"steps":[[700,"call","VerifyAllocationAccount",1]]},{"name":"VerifySalesLine","line":731,"kind":"procedure","access":"local","params":1,"steps":[[736,"call","AllocationAccountUsed",1],[739,"event","OnBeforeVerifySalesLine",0],[741,"call","VerifySelectedAllocationAccountNo",1],[747,"call","VerifyAllocationAccount",1],[748,"ext","codeunit",2675,"VerifyNoInheritFromParentUsed",1]]}]}