Announcements
Hi,
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;
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.
Primary key of PurchaseRecptLine is Document No. and Line No.
You may have multiple Lines in PurchaseRecptLine.
Do you want to update all lines?
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;
You have to get the receipt lines from receipt header and use in code.
//get Lines and your logic
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;
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;
André Arnaud de Cal...
293,998
Super User 2025 Season 1
Martin Dráb
232,850
Most Valuable Professional
nmaenpaa
101,158
Moderator