codeunit 50112 MyCodeunit { [EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch.-Post", OnPostItemJnlLineOnAfterDocumentFields, '', false, false)] local procedure OnPostItemJnlLineOnAfterCopyDocumentFields(var ItemJournalLine: Record "Item Journal Line"; PurchaseLine: Record "Purchase Line"; WarehouseReceiptHeader: Record "Warehouse Receipt Header"; WarehouseShipmentHeader: Record "Warehouse Shipment Header"; PurchRcptHeader: Record "Purch. Rcpt. Header"); begin ItemJournalLine."Purch Document No." := PurchaseLine."Document No."; end; [EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Jnl.-Post Line", OnAfterInitItemLedgEntry, '', false, false)] local procedure OnAfterInitItemLedgEntry(var NewItemLedgEntry: Record "Item Ledger Entry"; var ItemJournalLine: Record "Item Journal Line"; var ItemLedgEntryNo: Integer); begin NewItemLedgEntry."Purch Document No." := ItemJournalLine."Purch Document No."; end; } tableextension 50112 MyExtension extends "Item Journal Line" { fields { field(50000; "Purch Document No."; Code[20]) { Caption = 'Purch Document No.'; DataClassification = CustomerContent; } } } tableextension 50113 MyExtension2 extends "Item Ledger Entry" { fields { field(50000; "Purch Document No."; Code[20]) { Caption = 'Purch Document No.'; DataClassification = CustomerContent; } } } pageextension 50113 MyExtension extends "Item Ledger Entries" { layout { addafter("Document No.") { field("Purch Document No."; Rec."Purch Document No.") { ApplicationArea = All; } } } }
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch. Post Invoice Events", 'OnPrepareLineOnAfterFillInvoicePostingBuffer', '', false, false)] local procedure OnPrepareLineOnAfterFillInvoicePostingBuffer(var InvoicePostingBuffer: Record "Invoice Posting Buffer"; PurchLine: Record "Purchase Line"; var TempInvoicePostingBuffer: Record "Invoice Posting Buffer" temporary; var FALineNo: Integer; var InvDefLineNo: Integer; var DeferralLineNo: Integer; var IsHandled: Boolean) begin InvoicePostingBuffer."Custom Field" := PurchLine."Custom Field"; end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch. Post Invoice Events", 'OnPrepareGenJnlLineOnAfterCopyToGenJnlLine', '', false, false)] local procedure OnPrepareGenJnlLineOnAfterCopyToGenJnlLine(var GenJnlLine: Record "Gen. Journal Line"; PurchHeader: Record "Purchase Header"; InvoicePostingBuffer: Record "Invoice Posting Buffer") begin GenJnlLine."Custom Field" := InvoicePostingBuffer."Custom Field"; end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Line", 'OnAfterInitGLEntry', '', false, false)] local procedure OnAfterInitGLEntry(var GLEntry: Record "G/L Entry"; GenJournalLine: Record "Gen. Journal Line"; Amount: Decimal; AddCurrAmount: Decimal; UseAddCurrAmount: Boolean; var CurrencyFactor: Decimal; var GLRegister: Record "G/L Register") begin GLEntry."Custom Field" := GenJournalLine."Custom Field"; end;
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
OussamaSabbouh 3,377
Jainam M. Kothari 2,696 Super User 2025 Season 2
YUN ZHU 1,512 Super User 2025 Season 2