I’m revisiting a BAQ that I created to list Shipments that will include the ship to address. My understanding is that the Ship to address details for any shipment will come from one of 5 areas -
Order Release OTS fields
Order Release Ship to number
Order Header OTS fields
Order Header Ship to number
Order Customer
In my current BAQ, I calculate each address detail field based on the data in the Use OTS and Shipto number fields. Is there an easier way that I’m not seeing?
You should be able to just use the Order Release OTS and Ship To values. The Customer and Order Header values just act as defaults for the Releases, as far as I’m aware.
OTS fields only have data in them if they (the Order or release) were setup as OTS.
You must check the UseOTS field, as the OTSxxxxx fields can contain data even when UseOTS is false. Like if a Release was setup with an OTS address, and then switched to an existing ShipTo address.
The following shows Line-Rel 3-1 and 30-1 as having data in the OrderRel.OTSAddress1 field, even though those releases are not currently marked as OTS
I can show you examples where UseOTS and OTS fields are populated on the Order Header, but that information is not copied to the order release, so my experience is that I have to look at both the release fields and the order header fields.
if(OrderRel.UseOTS == true){
// use OrderRel.OTS Address1, OTSAddress2, etc.. for this release
}
else if (OrderRel.ShipToNum <> null){
// use ShipTo.Address1, ShipTo.Address2, etc..
// where ShipTo.CustNum == OrderHed.CustNum
// && ShipTo.ShipToNum == OrderRel.ShipToNum
// for this release
}
else if (OrderHed.UseOTS == true){
// use OrderHed.OTS Address1, OTSAddress2, etc.. for this release
}
else {
// use ShipTo.Address1, ShipTo.Address2, etc..
// where ShipTo.CustNum == OrderHed.CustNum
// && ShipTo.ShipToNum == OrderHed.ShipToNum
// for this release
}