Applying vendor address change to all open Purchase Orders

JanAJanA Member Posts: 2
We often have a large number of open purchase orders to which a change in address for a single vendor needs to be applied. Is there a simple way for a non-super user to do this?

Comments

  • SavatageSavatage Member Posts: 7,142
    There a bunch of ways - one would be a processing report.
    Based on the Purchase Header table.
    Onaftergetrecord you can do a....
    if Vendor.GET("Buy-from Vendor No.") then begin
      Name := Vendor.Name;
      "Ship-to Address" := Vendor.Address;
      "Ship-to Address 2" := Vendor."Address 2";
      "Ship-to City" := Vendor.City;
      State := Vendor.State;
      "ZIP Code" := Vendor."ZIP Code";
      "Country Code" := Vendor."Country Code";
      plus any other fields you want to update
      Modify;
    End;
    

    Another way could be to filter on the vendor number.
    Make sure they are all Status:Open
    and have a processing report Revalidate the "Buy-from Vendor No." only to update.

    or you could filter on the vendor number you want to update and filter on status=open, then manually go to the "Buy-from Vendor No." hit f2->enter->next and zip thru them yourself.***

    or you could use the object designer to run the pucrahse header table. filter on the vendor in question. Edit the first line as you want & F8 all the way down correcting each header.

    Pick one that fits your current nav skill level.

    *** Not knowing your permissions & security this manual version will allow you to update a bunch fairly quickly & easily
  • Mike_HWGMike_HWG Member Posts: 104
    Instead of a processing report, I think you could use a codeunit that leveraged the power of MODIFYALL, right?

    Create a codeunit, name it something like 'Vendor Management', with a function:
    UpdatePOAddresses(Vendor : Record Vendor)
    
    PurchaseHeader.SETCURRENTKEY("Buy-from Vendor No.");
    PurchaseHeader.SETRANGE("Buy-from Vendor No.",Vendor."No.");
    IF PurchaseHeader.FINDSET(TRUE) THEN BEGIN
      MODIFYALL(Name,Vendor.Name);
      MODIFYALL("Ship-to Address",Vendor.Address);
      MODIFYALL("Ship-to Address 2",Vendor."Address 2");
      MODIFYALL("Ship-to City",Vendor.City);
      MODIFYALL(State,Vendor.State);
      MODIFYALL("ZIP Code",Vendor."ZIP Code");
      MODIFYALL("Country Code",Vendor."Country Code");
      // plus any other fields you want to update
    END;
    

    The MODIFYALL is an incredibly fast function, which is why I'd try testing with it first. I've only had to use it when modifying just one field, so I'm not sure how it behaves when you want to do multiple fields at once like this.

    Make sure you know what MODIFYALL is doing, though - read the help first to make sure the application works for you!!

    Next, I would add code to the Vendor Card that triggered during an OnModifyRecord.
    IF (xrec.Name <> Name) OR (xrec.Address <> Address) // ...and so on...
    THEN BEGIN
      IF CONFIRM('Do you want to update Purchase Orders with the new Vendor information?') THEN
        VendorManagement.UpdatePOAddresses(Rec);
    END;
    
    Michael Hollinger
    Systems Analyst
    NAV 2009 R2 (6.00.34463)
Sign In or Register to comment.