Due to a request from our sales department, I’ve been tasked with getting the terms code on an order to auto populate into a UD field. I added OrderHed.Character02 to the order header summary sheet. I created a BPM with the following code to drop the terms code for the customer into this field and it works. However, the request has now changed and they only want the terms code to drop into this field when the customer has COD or credit card terms. I don’t know much about ABL, it’s a miracle I got this far on my own. How would I incorporate the if, then statement.
/* get terms code for character02 field */
For Each ttOrderHed Where ttOrderHed.Company = cur-comp, Each Customer where ttOrderHed.Company = Customer.Company and ttorderHed.CustNum = Customer.CustNum.
I see you’re going back to the Customer to get that info, but the TermsCode is a field that’s already stored on OrderHed. Just wondering whether you knew it was there or not?
AS it’s already there, you should be able to do something more simple in ABL without cross referencing tables:
For each ttOrderHed Where ttOrderHed.TermsCode = “COD” or “CC”.
Assign ttOrderHed.Character02 = ttOrderHed.TermsCode
I’ve never used ABL code, so somebody else will need to jump in with correct syntax I just posted to query where to get data from.
You would have to replace the terms codes with the actual terms codes but:
For Each ttOrderHed Where ttOrderHed.Company = cur-comp, Each Customer where ttOrderHed.Company = Customer.Company and ttorderHed.CustNum = Customer.CustNum:
If Customer.TermsCode = “COD” or Customer.TermsCode = “CC” then
Assign ttOrderHed.Character02 = Customer.TermsCode.
End.
JOE ROJAS
Epicor Applications Manager
VENTION MEDICAL + DESIGN & DEVELOPMENT
DIRECT: 508.597.1392 x1625 | MOBILE: 774.826.9245
One more alternative, with which you could avoid the IF statement
For Each ttOrderHed Where ttOrderHed.Company = cur-comp, Each Customer where ttOrderHed.Company = Customer.Company and ttorderHed.CustNum = Customer.CustNum and (Customer.TermsCode = “COD” or Customer.TermsCode = “CC”):
Assign ttOrderHed.Character02 = Customer.TermsCode.
End.