A bpm to stop creating a sales order with an inactive part

epicor version 9.05.701

I need a bpm to prevent sales orders being raised where the partnumber is inactive.

Has anybody done this before? It sounds a fairly simple request, but the system allows you to write any part number into the field even if the part number doesn’t exist.

Many thanks in advance.

Put a pre-processing BPM on ChangePartNumber / ChangePartNumberMaster where you lookup the part and if it isn’t found Raise Exception

Im not sure this would be 100% bullet proof for us - occasionally we do put “non part numbers” through like for instance if we were to sell scrap metal and an order has to be raised. (its a different form of income, not turnover generated for us).

After testing - this message appears - (which i think is system generated because i can’t find a bpm that has been written)…but if you click “ok”…you can simply proceed.
What i’m looking for is IF the part is inactive…then stop altogether

So what I’ve found from the below testing is that:

  1.  When creating a SO and you use the search button – inactive parts don’t show up…..(see screenshot below).
    
  2.  When you just type it into the part field (without searching)….it recognises that it is inactive and the processor is prompted to either click “ok” or “cancel”. Ok lets them continue.
    
  3.  The message that appears is not a bpm setup by Prior. It seems to be a system built notification.

Put a pre processing BPM with BAQ that will look up if part is inactive, if inactive than raise an exception

1 Like

Would you be so kind as to tell me how I should set up the method directive?
Would it be pre processing on salesorder.update?
Then, I can write the action but I’m not sure about how to apply the condition.

Thanks.

Just do a pre processing on ChangePartNum that if it finds the Part In-Active it throws an exception. otherwise if it doesn’t find it at alll or it finds it Active it deosn’t do anything.

Pre Processsing on ChangePartNum and ChangePartNumMaster should do it.

Well this was interesting. On adding the part the message came up but the exception did not stop the part from getting to the order, so I did a second one on update that will actually stop the add. They are attached.

stop inactive.bpm (26.8 KB)

Thanks Greg,

Only 1 glitch - i can’t import it as were on different versions.
Is there any chance you can send me screenshots of what you’ve done to get this working?

image

Many thanks.

Just having a practice on a data directive…the below works to a point but it errors on EVERY part i type in, in-active or not.
It is also extremely slow when you click save.

Hi

You’re checking against the Part table, check against ttPart instead. It’ll be slow because you’re checking all your hundreds or thousands of parts.

Regards
Mark

1 Like

Hi Mark,

This seems to have done it.

1 Like

Perfect – sorry didn’t properly look at which screen you were on, but hopefully steered you in the correct direction.

1 Like

Here is the ABL code I used. It is essentially what you came up with.

In Salesorder.Update.

/* check Inactive */ 

define variable Msg as character init ''.

For each ttOrderDtl.

	For each Part where ttOrderDtl.Company = Part.Company and ttOrderDtl.Partnum = Part.Partnum no-lock.

			If Part.Inactive = True Then Do:

					
					Msg = "Part is Inactive, Cannot be added".
	
					{lib/PublishEx.i &ExMsg = Msg &ExType = {&MESSAGE_ERR}}.


		  End.

	End.

End.

In Sales Order.ChangePartNumMaster

/* check Inactive */ 

define variable Msg as character init ''.

For each ttOrderDtl where PartNum = ttOrderDtl.PartNum.

	For each Part where ttOrderDtl.Company = Part.Company and ttOrderDtl.Partnum = Part.Partnum no-lock.

			If Part.Inactive = True Then Do:

					ttOrderDtl.PartNum = ''.
					PartNum = ''.
					
					Msg = "Part is Inactive, Cannot be added".
	
					{lib/PublishEx.i &ExMsg = Msg &ExType = {&MESSAGE_ERR}}.


		  End.

	End.

End.

what we have is great for a basic level.

but i’m just wondering - will this work for intercompany transactions?..as these are not entered via a processor, they are pulled through the intercompany process and auto generated.

You can test it and see if it works, and you can also make BPM available to all the companies so no inactive parts come through via inter company process

Any reason why you would not want to put the inactive part on hold with a relevant on hold reason? This would achieve the same thing using core system functionality - can’t sell the part, stops you releasing jobs and shipping the part - you could create a specific on hold code.

All you would then need to do is write a simple bpm that when you make the part inactive it sets it to the correct on hold code.