{"title":"Codeunit 6404 E-Doc. Create Purch. Cr. Memo, extension points 29","url":"https://jonas-paprotka.de/ref/codeunit/6404-e-doc-create-purch-cr-memo/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-24","object":{"type":"codeunit","id":6404,"name":"E-Doc. Create Purch. Cr. Memo","app":"E-Document Core","url":"https://jonas-paprotka.de/ref/codeunit/6404-e-doc-create-purch-cr-memo/"},"major":29,"source":{"url":"https://jonas-paprotka.de/ref/codeunit/6404-e-doc-create-purch-cr-memo/source/","path":"src/Apps/W1/EDocument/App/src/Processing/Import/FinishDraft/EDocCreatePurchCrMemo.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":{"codeunit:6122":{"name":"E-Doc. Imp. Session Telemetry","url":"https://jonas-paprotka.de/ref/codeunit/6122-e-doc-imp-session-telemetry/"},"codeunit:6402":{"name":"E-Doc. Purch. Doc. Helper","url":"https://jonas-paprotka.de/ref/codeunit/6402-e-doc-purch-doc-helper/"},"table:6100":{"name":"E-Document Purchase Header","url":"https://jonas-paprotka.de/ref/table/6100-e-document-purchase-header/"},"codeunit:8711":{"name":"Telemetry","url":"https://jonas-paprotka.de/ref/codeunit/8711-telemetry/"},"table:38":{"name":"Purchase Header","url":"https://jonas-paprotka.de/ref/table/38-purchase-header/"},"table:98":{"name":"General Ledger Setup","url":"https://jonas-paprotka.de/ref/table/98-general-ledger-setup/"},"table:6141":{"name":"E-Doc. Record Link","url":"https://jonas-paprotka.de/ref/table/6141-e-doc-record-link/"},"codeunit:66":{"name":"Purch - Calc Disc. By Type","url":"https://jonas-paprotka.de/ref/codeunit/66-purch-calc-disc-by-type/"}},"procs":[{"name":"ApplyDraftToBC","line":29,"kind":"procedure","params":2,"steps":[[39,"ext","codeunit",6122,"SetBool",2],[44,"ext","codeunit",6402,"FinalizeCreatedDocument",2]]},{"name":"RevertDraftActions","line":49,"kind":"procedure","params":1,"steps":[[59,"ext","codeunit",6402,"RevertCreatedDocument",1]]},{"name":"ApplyToOriginalInvoice","line":62,"kind":"procedure","access":"local","params":2,"steps":[[70,"ext","codeunit",6122,"SetText",2],[71,"ext","codeunit",6402,"PreventApplyToOldestOnPosting",1],[76,"ext","codeunit",6402,"IsOpenInvoiceToApplyTo",4]]},{"name":"CreatePurchaseCreditMemo","line":85,"kind":"procedure","params":1,"steps":[[99,"ext","table",6100,"GetFromEDocument",1],[100,"ext","codeunit",6402,"AllDraftLinesHaveTypeAndNumber",1],[101,"ext","codeunit",8711,"LogMessage",5],[110,"ext","codeunit",6402,"ValidateFieldWithContext",3],[112,"ext","codeunit",6402,"ValidateFieldWithContext",3],[117,"ext","table",38,"FindPostedDocumentWithSameExternalDocNo",2],[119,"ext","codeunit",8711,"LogMessage",5],[123,"ext","codeunit",6402,"ValidateFieldWithContext",3],[126,"write",38,"Insert",1],[127,"ext","codeunit",6402,"ApplyDefaultPostingDateFromSetup",2],[128,"write",38,"Modify"],[130,"ext","table",98,"GetRecordOnce",0],[131,"ext","table",98,"GetCurrencyCode",0],[132,"ext","codeunit",6402,"ValidateFieldWithContext",3],[134,"call","ApplyToOriginalInvoice",2],[136,"write",38,"Modify"],[138,"ext","table",6141,"InsertEDocumentHeaderLink",2],[140,"ext","codeunit",6402,"GetLastPurchaseLineNo",2],[145,"ext","codeunit",6402,"CreatePurchaseLineFromDraft",4],[148,"write",38,"Modify"],[149,"ext","codeunit",66,"ApplyInvDiscBasedOnAmt",2]]}]}