Skip to main content

Notifications

Announcements

No record found.

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

Help:need to flow Fileds from "Warehouse Receipt Line" to Purch. Recpt Line"

Posted on by 221
Hi Experts 
I need to flow field from "Warehouse Receipt Line" to Purch. Recpt Line"  but not able to find any event subsciber in Codeunit::"Whse.-Post Receipt" can any one help me to flow using event subsciber or any other way any help Really appriciated 
i have added other sample code bellow event sub code which moving data from  "Warehouse Receipt Line" to "Posted Whse. Receipt Line" 
in my our we need to move data from   "Warehouse Receipt Line" to Purch. Recpt line
sample code 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Post Receipt", 'OnAfterPostedWhseRcptLineInsert', '', true, true)]
    local procedure OnAfterPostedWhseRcptLineInsert(var PostedWhseReceiptLine: Record "Posted Whse. Receipt Line"; WarehouseReceiptLine: Record "Warehouse Receipt Line")
    var

    begin
        PostedWhseReceiptLine."Supplier Lot No." := WarehouseReceiptLine."Supplier Lot No.";
        PostedWhseReceiptLine.Remarks := WarehouseReceiptLine.Remarks;
        PostedWhseReceiptLine."Supplier Date" := WarehouseReceiptLine."Supplier Date";
        PostedWhseReceiptLine."QC Inspector" := WarehouseReceiptLine."QC Inspector";
        PostedWhseReceiptLine."Sample Qty" := WarehouseReceiptLine."Sample Qty";

    end;
   
  • Suggested answer
    Amit_Sharma Profile Picture
    Amit_Sharma 2,545 on at
    RE: Help:need to flow Fileds from "Warehouse Receipt Line" to Purch. Recpt Line"

    Hi,

    local procedure OnAfterPostedWhseRcptLineInsert(var PostedWhseReceiptLine: Record "Posted Whse. Receipt Line"; WarehouseReceiptLine: Record "Warehouse Receipt Line")
        var
            PurchaseRecptHeader: Record "Purch. Rcpt. Header";
            PurchaseRecptLine: Record "Purch. Rcpt. line";
        begin
            if PostedWhseReceiptLine."Posted Source Document" = PostedWhseReceiptLine."Posted Source Document"::"Posted Receipt" then begin
                PurchaseRecptLine.reset;
                PurchaseRecptLine.setrange("Document No.",PostedWhseReceiptLine."Posted Source No.");
                if PurchaseRecptLine.FindSet() then begin
                    Repeat
                        PurchaseRecptLine."Supplier Lot No." := WarehouseReceiptLine."Supplier Lot No.";
                        PurchaseRecptLine.Remarks := WarehouseReceiptLine.Remarks;
                        PurchaseRecptLine."Supplier Date" := WarehouseReceiptLine."Supplier Date";
                        PurchaseRecptLine."QC Inspector" := WarehouseReceiptLine."QC Inspector";
                        PurchaseRecptLine."Sample Qty" := WarehouseReceiptLine."Sample Qty";
                        PurchaseRecptLine.Modify
                    until PurchaseRecptLine.next =0;
                end;
            end;

        end;
    Regards
    Amit Sharma
    linkedin.com/in/amit-sharma-94542440/
    Pls press yes if info is useful.
  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Help:need to flow Fileds from "Warehouse Receipt Line" to Purch. Recpt Line"

    You have to write something like

    PurchaseRecptLine.SetRange("Document No.", PurchaseRecptHeader."No.");

               if PurchaseRecptLine.FindSet() then

                   repeat

                       PurchaseRecptLine."Custom field" := WarehouseReceiptLine."Custom field";

                       PurchaseRecptLine.Modify();

                   until PurchaseRecptLine.Next() = 0;

  • DineshM Profile Picture
    DineshM 221 on at
    RE: Help:need to flow Fileds from "Warehouse Receipt Line" to Purch. Recpt Line"

    yes sir

    need to update if there  single lines then single lines updation and if mutiple lines then multiple lines update from warehouse Recpt line to purch Receipt Line.

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Help:need to flow Fileds from "Warehouse Receipt Line" to Purch. Recpt Line"

    Primary key of PurchaseRecptLine is Document No. and Line No.

    You may have multiple Lines in PurchaseRecptLine.

    Do you want to update all lines?

  • DineshM Profile Picture
    DineshM 221 on at
    RE: Help:need to flow Fileds from "Warehouse Receipt Line" to Purch. Recpt Line"

    Hi sir ,

    I have added following Code but it will give error as follows while post Receipt action

    local procedure OnAfterPostedWhseRcptLineInsert(var PostedWhseReceiptLine: Record "Posted Whse. Receipt Line"; WarehouseReceiptLine: Record "Warehouse Receipt Line")

       var

           PurchaseRecptHeader: Record "Purch. Rcpt. Header";

           PurchaseRecptLine: Record "Purch. Rcpt. line";

       begin

           if PostedWhseReceiptLine."Posted Source Document" = PostedWhseReceiptLine."Posted Source Document"::"Posted Receipt" then begin

               PurchaseRecptLine.Get(PostedWhseReceiptLine."Posted Source No.");

               PurchaseRecptLine."Supplier Lot No." := WarehouseReceiptLine."Supplier Lot No.";

               PurchaseRecptLine.Remarks := WarehouseReceiptLine.Remarks;

               PurchaseRecptLine."Supplier Date" := WarehouseReceiptLine."Supplier Date";

               PurchaseRecptLine."QC Inspector" := WarehouseReceiptLine."QC Inspector";

               PurchaseRecptLine."Sample Qty" := WarehouseReceiptLine."Sample Qty";

           end;

       end;

    pastedimage1677148170317v1.png

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Help:need to flow Fileds from "Warehouse Receipt Line" to Purch. Recpt Line"

    You have to get the receipt lines from receipt header and use in code.

    //get Lines and your logic

  • DineshM Profile Picture
    DineshM 221 on at
    RE: Help:need to flow Fileds from "Warehouse Receipt Line" to Purch. Recpt Line"

    Hi sir

    Thank you for your Response 

    I have modified code as follow but How it will update Purch Recpt line as no Record variable taken as purch. Recpt line 

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Post Receipt", 'OnAfterPostedWhseRcptLineInsert', '', true, true)]

       local procedure OnAfterPostedWhseRcptLineInsert(var PostedWhseReceiptLine: Record "Posted Whse. Receipt Line"; WarehouseReceiptLine: Record "Warehouse Receipt Line")

       var

           PurchaseRecptHeader: Record "Purch. Rcpt. Header";

       begin

           if PostedWhseReceiptLine."Posted Source Document" = PostedWhseReceiptLine."Posted Source Document"::"Posted Receipt" then begin

               PurchaseRecptHeader.Get(PostedWhseReceiptLine."Posted Source No.");

               PostedWhseReceiptLine."Supplier Lot No." := WarehouseReceiptLine."Supplier Lot No.";

               PostedWhseReceiptLine.Remarks := WarehouseReceiptLine.Remarks;

               PostedWhseReceiptLine."Supplier Date" := WarehouseReceiptLine."Supplier Date";

               PostedWhseReceiptLine."QC Inspector" := WarehouseReceiptLine."QC Inspector";

               PostedWhseReceiptLine."Sample Qty" := WarehouseReceiptLine."Sample Qty";

           end;

       end;

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Help:need to flow Fileds from "Warehouse Receipt Line" to Purch. Recpt Line"

    You can use same subscriber and get the Purch. Recpt Header and Lines and update

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Post Receipt", 'OnAfterPostedWhseRcptLineInsert', '', false, false)]

       local procedure OnAfterPostedWhseRcptLineInsert(var PostedWhseReceiptLine: Record "Posted Whse. Receipt Line"; WarehouseReceiptLine: Record "Warehouse Receipt Line");

       var

           PurchaseRecptHeader: Record "Purch. Rcpt. Header";

       begin

           if PostedWhseReceiptLine."Posted Source Document" = PostedWhseReceiptLine."Posted Source Document"::"Posted Receipt" then begin

               PurchaseRecptHeader.Get(PostedWhseReceiptLine."Posted Source No.");

               //get Lines and your logic

           end;

       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.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans