Data Directive on OrderRel

I have a BPM that is sort of working. I added the BOLD.

When an order line is entered and the Plant is not GDL and the ReqDate is > 30 days, it will give a pop.

I cant get the Plant and Date to update, I was able to get the ShipViaCode to update.

DEFINE VARIABLE BPMMessage AS CHARACTER INIT ‘’ NO-UNDO.

FOR FIRST ttOrderRel
WHERE ttOrderRel.Company = cur-comp AND ttOrderRel.RowMod = ‘A’
NO-LOCK:
IF (ttOrderRel.ReqDate > ADD-INTERVAL(TODAY, 30, “days”) AND ttOrderRel.Plant <> ‘GDL’) THEN DO:
{lib/findtbl.i &QFind = first
&QLock = no-lock
&QTableName = UD28
&QWhere = “UD28.Company = CUR-COMP AND UD28.Key1 = ttOrderRel.PartNum”}
IF AVAIL(UD28) THEN DO:
ASSIGN BPMMessage = “Order was changed to GDL, this assembly is approved to be built at that site.”.
ASSIGN ttOrderRel.Plant = “GDL”.
ASSIGN ttOrderRel.ReqDate = ADD-INTERVAL(ttOrderRel.ReqDate, 7, “days”).
ASSIGN ttOrderRel.ShipViaCode = “UPS7”.
{lib/PublishInfoMsg.i &InfoMsg = BPMMessage}.
validate ttOrderRel.
END.
END.
END.

It may have to do with the fact that you are trying to change the fields you’re triggering on.

In E10, there are two kinds of DD’s: Standard - and In-Transaction If I want to change the value of the field that triggers the DD, I must use the In-Trans type.

It’s an In-Tran DD.

So I probably need a NO-LOCK somewhere in the first IF statement.

Yes and if you’re updating tt fields and triggering on the update of tt fields, you can use the built-in “prevent infinite loops” at least until you’ve gone through development and some testing.