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;
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,269 Super User 2024 Season 2
Martin Dráb 230,198 Most Valuable Professional
nmaenpaa 101,156