Phew!!! Finally figured it out.
remove this line...
and ShipTo.ShipToNum = ttOrderHed.ShipToNum
remove this line...
and ShipTo.ShipToNum = ttOrderHed.ShipToNum
--- In vantage@yahoogroups.com, "vantagewow" <jsmith@...> wrote:
>
> I have the below code which will set the orderhed ship date automatically and I need it to be changed to set the orderdtl.requestdate automatically. I was given the code so I have been trying to change it to get it to work and can't. I can change it and get it to work for the rel.reqdate....but would really prefer it to work with orderdt. Can anyone help me?
> Thanks
>
> define var BPMDayNum as integer no-undo initial 0.
> define var BPMValidDays as integer no-undo initial 0.
> define var BPMDeliveryDays as integer no-undo initial 1.
> define var BPMCalendarDays as integer no-undo initial 0.
>
> /* Get the delivery days from the customer shipto table and get a starting date*/
>
> for each ttOrderHed where (ttOrderHed.RowMod = "A" or ttOrderHed.RowMod = "U") no-lock.
> for each ShipTo
> where ShipTo.Company = ttOrderHed.Company
> and ShipTo.ShipToNum = ttOrderHed.ShipToNum
> and Shipto.DemandDeliveryDays <> 0 no-lock.
> BPMDeliveryDays = ShipTo.DemandDeliveryDays.
> end.
>
> /* start looping though the production calender until we have enough valid dates */
> Repeat While BPMValidDays <= BPMDeliveryDays :
> BPMCalendarDays = BPMCalendarDays + 1.
>
> ttOrderHed.RequestDate = ttOrderHed.NeedByDate - ( BPMCalendarDays - 1).
>
> for each company where company.company = cur-comp no-lock.
> Find ProdCalDay
> where ProdCalDay.Company = ttOrderHed.Company
> and ProdCalDay.CalendarID = company.CalendarID
> and ProdCalDay.ModifiedDay = ttOrderHed.RequestDate no-error.
> /* at this point, if we are here, and don't have a record, its not a holiday.*/
> if not available ProdCalDay and weekday(ttorderhed.requestdate) <> 1 and weekday(ttorderhed.requestdate) <> 7 then do:
> BPMDayNum = WeekDay(ttOrderHed.RequestDate).
> BPMValidDays = BPMValidDays + 1.
> end.
> end.
>
> end.
> end.
>