Altering the address of POs created from PO Suggestions

Hello folks,

Back in November, I had an issue trying to get the address of Purchase Orders to match the address of the user’s plant (see Altering the address of a PO when a new PO header is requested - Vista/Vantage 8 - Epicor User Help Forum). I was able to accomplish this, with help from the folks on this forum. The method I used was to add new code to the PO.GetNewPOHeader’s Post-Processing section. The code I added was:
synchronously execute 4GL return record call, return
/* Assign plant address to PO header */

For each ttPOHeader,
      each Plant where Plant.Company = ttPOHeader.Company and Plant.Plant = Cur-plant.

                Message "In assign plant address"  + string(ttPOHeader.PONum).

                Assign ttPOHeader.ShipAddress1 = Plant.Address1
                           ttPOHeader.ShipAddress2 = Plant.Address2
                           ttPOHeader.ShipAddress3 = Plant.Address3
                           ttPOHeader.ShipCity = Plant.City
                           ttPOHeader.ShipState = Plant.State
                           ttPOHeader.ShipZip = Plant.Zip.

                Find Country where Country.Company=Plant.Company and Country.CountryNum=Plant.CountryNum no-error.
                If available Country Then do:
                           Assign   ttPOHeader.ShipCountry = Country.ISOCode
                                        ttPOHeader.ShipCountryNumDescription = Country.Description.
                End.
End.

This worked and all new POs entered on the Purchase Order Entry screen have the correct address.
Now I need to do the same thing to handle POs created when the user goes to the New PO Suggestions screen and selects the Generate New PO action.
My issue is that I am not sure which Method Directive to add the code to. And once I get to Method Directive, how do I know which tables are available for me to work with?
If you have any knowledge in this area, I would appreciate a nudge in the right direction.

Clive

I would get rid of the method directive you have and add a data directive for the table POHeader. This will address either scenario.

The condition would be:

the POHeader.RowMod field of the changed row is equal to the "A" expression

and execute this CODE or something similar:

for each ttpoheader, each plant where plant.Company = ttpoheader.Company and plant.Plant = ttCallContextClient.CurrentPlant no-lock.

If available plant then do:

Assign ttpoheader.ShipName = plant.Name.
Assign ttpoheader.ShipAddress1 = plant.Address1.
Assign ttpoheader.ShipAddress2 = plant.Address2.
Assign ttpoheader.ShipAddress3 = plant.Address3.
Assign ttpoheader.ShipCity = plant.City.
Assign ttpoheader.ShipState = plant.State.
Assign ttpoheader.ShipZIP = plant.Zip.
Assign ttpoheader.ShipCountryNum = plant.CountryNum.

end.

end.
1 Like

Thank you, Dan, but I still need a pointer…

Forgive me, but I am working from very little documentation and basically just flying by the seat of my pants here.

How would I create a data directive for the POHeader table? When I enter the Method Directives screen, I see that I can do a search on “Method Code”, but “POHeader” does not appear in the entries in the Business Object drop down. The “Directive Group” dropdown only shows groups I have previously created.

What steps would I follow to be able to attach a directive to a table? (BTW: being able to attach a directive to a table sounds fantastic ! ! ! I could resolve a lot of other issues if I knew how to do this).

Many thanks,

Clive

A Data Directive is different than a BPM.

DD’s work by monitoring the database tables. BPM’s work by monitoring Business Processes.

DD’s work great for changing data in the record being changed.

Thanks for the additional information.

But how do I create one? I see no menu entries related to “Data Directives” and the Epicor Tools User Guide (pretty well the only documenatation I have), says nothing about them either.

My bad. In V8 They are BAM’s (Business Activity Manager)

image

See Chapter 10 of Sign In

The code that danbedwards posted will need to be put in a text file (with extension “.P”) an stored on the V8 server (I forget where I stored mine, it was in a sub-directory of the \server folder)

In the BAM, chose the file from above as the Alert Program.

It’s been 2 yrs since I’ve been on V8, so I might be off on some things.