Transfering field from line to header

DP_JoeyTDP_JoeyT Member Posts: 3
Hi all,

We have a customer migrating from 2009 to 2018, and they have requested for the Sales Order / Transfer Order no. to be visible in the lists of the Warehouse Receipts/ Warehouse Shipments pages.

As the Warehouse line tables have the source no. fields, we are currently referencing them in a subscriber event onafterinsert in the warehouse tables.

This is the code used:

(Receipt)
IF Rec.ISTEMPORARY THEN
  EXIT;

//WhseRepHdr.RESET;
//vRec.RESET;


WhseRepHdr.SETRANGE("No.", Rec."No.");
IF WhseRepHdr.FINDFIRST THEN BEGIN
    IF  WhseRepHdr."Source No." = '' THEN BEGIN
       WhseRepHdr."Source No." := Rec."Source No.";
        WhseRepHdr.MODIFY;
      END;
  END;

(Shipment):
IF Rec.ISTEMPORARY THEN
  EXIT;

WhseShipHdr.RESET;
vRec.RESET;



WhseShipHdr.SETRANGE("No.", Rec."No.");
IF WhseShipHdr.FINDFIRST THEN BEGIN
  IF WhseShipHdr."Source No." = '' THEN BEGIN
 vRec.SETRANGE("No.", WhseShipHdr."No.");
  IF vRec.FINDFIRST THEN BEGIN
    WhseShipHdr."Source No." := vRec."Source No.";
    WhseShipHdr.MODIFY;
    END;
    END;
    END;

The one for the Warehouse Shipment table is working, however, the one for the Receipt header is still blank on the list and page, even though debugging shows that the field is populated when the event is run.

Please kindly advice on why this might be happening.

Thank you very much!

Joey.

Best Answer

Answers

Sign In or Register to comment.