Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Flow data from Purchase line to G/l Entry etc

(1) ShareShare
ReportReport
Posted on by
Hello Everyone,
 
I have created one field which is posting description on purchase line then the same description of item will come in posting description and then posting description data will flow in G/l Entry, Item Ledger Entry, Posted Purchase Receipt line, Posted purchase Invoice these entity. which Events should i subscribe and then how the data will flow in business central.
 
Please suggest
Thank you
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 75,595 Super User 2024 Season 2 on at
    Flow data from Purchase line to G/l Entry etc
    Hi, I happen to have an example of Purchase Header to Item Ledger Entry here, I hope it can give you some tips.
    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;
                }
            }
        }
    }
     
    Thanks.
    ZHU

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.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans