I switched to Transaction method but then the fun began. Whatever I did I couldn't set the Approve field to false and the ApprovalStatus to U except when I didn't set any conditions. Of course this meant that every time I set the Approve manually it automatically reset it - which was pretty pointless. I then put a display msg in to the ABL code and noted that it was displaying three times during the Generate process. So I increased the Number01 field by 1 on each pass and when it equalled 2 I then set the fields and it worked. I then had to set a Method Directive on PO.Update to reset number01 to 0 so that should someone Approve, Unapprove and Approve again then it wouldn't be affected by the Data Directive.
Data Directive on POHeader
find first ttPOHeader where ttPOHeader.RowMod <> ''.
if available ttPOHeader and ttPOHeader.Number01 = 2 then do:
assign ttPOHeader.Approve = false.
assign ttPOHeader.ApprovalStatus = 'U'.
end.
assign ttPOHeader.Number01 = ttPOHeader.Number01 + 1.
Pre-Processing Method Directive on PO.Update
set the POHeader.Number01 field of the changed row to the 0 expression
Data Directive on POHeader
find first ttPOHeader where ttPOHeader.RowMod <> ''.
if available ttPOHeader and ttPOHeader.Number01 = 2 then do:
assign ttPOHeader.Approve = false.
assign ttPOHeader.ApprovalStatus = 'U'.
end.
assign ttPOHeader.Number01 = ttPOHeader.Number01 + 1.
Pre-Processing Method Directive on PO.Update
set the POHeader.Number01 field of the changed row to the 0 expression
--- In vantage@yahoogroups.com, "adrian.lauchlan" <adrianlauchlan@...> wrote:
>
> I have tried creating a Data Directive on POHeader. I don't have a condition set and I am using Standard rather than In Transaction. But it doesn't appear to do anything
>
> find first ttPOHeader where ttPOHeader.RowMod = 'A'.
> if available ttPOHeader and ttPOHeader.ApprovalStatus = 'A' then do:
> assign ttPOHeader.Approve = false.
> assign ttPOHeader.ApprovalStatus = 'U'.
> end.
>
> --- In vantage@yahoogroups.com, "adrian.lauchlan" <adrianlauchlan@> wrote:
> >
> > E9
> >
> > In New PO Suggestions I would like to be able to run the Generate Purchase Orders in the Actions Menu but not mark those POs generated as Approved.
> >
> > I have looked at doing it using a BPM and switching the field POHeader.Approve to false but all the POSugg Methods point to the temporary tables and I cannot see a link to the final Generated PO.
> >
> > Any suggestions as to how to do this
> >
>