As written below with the corrections, complies ok. I still think you’re better off triggering this on a sales order update method directive, as Nancy stated a while back.
Find First OrderHed where OrderHed.Company = ttOrderRel.Company AND OrderHed.OrderNum = ttOrderRel.OrderNum no-error.
If available OrderHed then do:
If OrderHed.HDCaseNum > 1 Then Do:
/* Set Order Release Warehouse Defaults */
Assign ttOrderRel.WarehouseCode = “RMA”.
End.
End.
When i click validate on the ABL code it no longer errors (Thanks Jim).
However, The warehouse still doesn’t change to RMA.
So, then i looked at Nancy’s suggestion and applied the same ABL code to a method directive SalesOrder.Update (post processing)…interestingly on here, i was able to add the additional line of Assign ttOrderRel.WarehouseCodeDescription = “RMA Warehouse” and it didn’t error.
The ABL script was validated BUT it still failed to change the warehouse when the process was ran.
If you’re working in the post-processing section of a Method Directive, I believe you need to update the non-temporary table. (You can update the temporary tables in the pre-processing, and possibly the base processing though). So, you would want an additional section in your code (probably below your If ttOrderHed.HDCaseNum > ‘1’ line) stating something along the lines of:
Find First OrderRel Where ttOrderRel.Company = OrderRel.Company AND ttOrderRel.OrderNum = OrderRel.OrderNum And ttOrderRel.OrderLine = OrderRel.OrderLine and ttOrderRel.OrderRelnum = OrderRel.OrderRelNum.
If Available OrderRel then:
(Make sure to add an extra “End.” to the bottom of your code to account for this added code.)
Then change the ttOrderRel tables in your two assign lines to just OrderRel.fieldYouWantUpdated.
I do something similar to this, I require all sales orders to be entered into the 04 warehouse (currently for other reasons we have the default warehouse set to another one) I have a data directive on the OrderRel table set up like this:
I have no conditions set up because I want all our sales orders to go to this warehouse but I’m sure you could add something to the Conditions section if you want it to be more specific.
Thanks John,
When i replicate yours it works…here is where the problem is, I need the condition to be where the OrderHed.HDCaseNum is greater than 1, however when i go to apply the condition you can only select from the ttOrderRel table…nothing for OrderHed
using the design option you can configure a query, and link the OrderRel to the OrderHed tables and if that returns a value then it would perform the action.
Like i said i haven’t done this much but it’s where I would look…
Thanks John, this seems to have nailed it.
It has slowed down the processing side but thats the “hit” with bpm’s…thank you so much for your help.
I’ll add screenshots of the fix below.:
aaaahhhhh, not quite…i spoke to soon.
I just tested putting on a normal order through order entry (not through hd case) and it defaulted to the RMA warehouse!