Thank you very much Nigel. For some reason your exactly wording was causing a 4GL error but once I change the BAM to monitor the OrderRel it worked great. Thank you for your help.
Emily
Emily
--- In vantage@yahoogroups.com, "Nigel Kerley" <nigel.kerley@...> wrote:
>
> Hi Emily,
>
> What seems to be happening is that Vantage is taking the change in quantity and changing the Order Release up/down by that amount. This in turn changes the Order Detail quantity before finally correcting it.
>
> Confusing, I know, so:
> * you have an OrderDtl with a quantity of 100 and one release with the same qty
> * you change the OrderDtl to 200
> * this increases the OrderRel quantity by 100 which in turn increases OrderDtl by 100 (up to 300)
> * then Vantage tots up all the OrderRel quantities for that line and sets OrderDtl equal to the total (so it's set back to 200)
>
>
> You might be better off creating the BAM against the OrderRel table using the OurReqQty field. Then try the following:
>
> /* Send email whenever a Sales Order Quantity changes */
> {ud/GlbAlert.i &TableName = "OrderRel"}
>
> DEFINE VARIABLE NewEmailBody AS CHARACTER NO-UNDO.
>
> FIND OrderHed WHERE OrderHed.OrderNum = OrderRel.OrderNum AND OrderHed.Company = OrderRel.Company no-lock no-error.
>
> ASSIGN Email-To = " me@..."
>
> Email-Subject = "Sales Order# " + STRING(OrderHed.OrderNum) + " - quantity change alert"
>
> NewEmailBody = "The required quantity was changed on order "
> + STRING(OrderHed.OrderNum) + " from "
> + STRING(OLDOrderRel.OurReqQty)
> + " to " + STRING(OrderRel.OurReqQty).
>
> assign Email-Text = NewEmailBody
>
>
>
> HTH,
>
> Nigel.
>
>
> --- In vantage@yahoogroups.com, "emverbeke" <emverbeke@> wrote:
> >
> > I wrote several BAMs that send out emails using .p files when an order's required date is changed, pn is changed, qty is changed, or cancelled. The date and pn notifications are working great. The qty change results in several emails being sent out and the quantities put into the email don't seem to make any sense (not what I would have thought such as ordered 20 changed to 10 so get an email for -10, etc). I put a rule on the BAM for the quantity to be greater than 0 and still no luck. Any ideas?
> >
> > FOR FIRST OrderHed WHERE OrderHed.OrderNum = OrderDtl.OrderNum AND OrderHed.Company = OrderDtl.Company AND OrderHed.Checkbox01 = TRUE:
> > assign Email-Text = "The required quantity was changed on order " + STRING(OrderHed.OrderNum) + " to " + STRING(OrderDtl.SellingQuantity).
> > assign SendEmail = true.
> > END.
> >
> >
> > Thank you advance!
> >
> > --Emily
> >
>