BPM code to check job Receipts to InventoryQty

Would anyone help me sort out a BPM which I plan to check quantity when executing job receipt to inventory.

Our warehouse staff have no restriction or checking about receive quantity

main menu --> material management --> inventory management --> general operations --> job receipt to inventory

What would be the BPM code to check the quantity entered exceeds the Qty Completed.

Do you know how to enable tracing? You will need to enable tracing, and then perform this procedure in a test environment to know which method to attach the BPM. I would then review the temp table record sets moving within the method. I would do a query to check quantity in the input record matches the completed quantity in the jobhead table. Is this the kind of detail you are wanting or do you need more in depth details.

Josh

1 Like

You can also add a form row rule to check the quantity and issue a warning.

Lee,

One approach is to setup a preprocessing directive on the ReceiptsFromMfg.ReceiveMfgPartToInventory Object/Method (That is what it is called in E10, I am thinking this is the same in E9 but you will have to verify that the method exists).

You can drop the following code in an execute code (4GL/ABL) action and it should work. This will not allow them to receive more than the jobs production quantity.

Ross


FOR EACH ttPartTran WHERE (ttPartTran.RowMod = ‘A’ OR ttPartTran.RowMod = ‘U’) NO-LOCK.

DEFINE VARIABLE QtyReceived As INTEGER NO-UNDO INITIAL 0.
DEFINE VARIABLE TextMessage As CHARACTER NO-UNDO.
DEFINE VARIABLE ProdQty AS INTEGER NO-UNDO INITIAL 0.

FIND FIRST JobHead WHERE JobHead.Company = CUR-COMP AND JobHead.JobNum = ttPartTran.JobNum NO-LOCK.
ASSIGN ProdQty = JobHead.ProdQty.

FOR EACH PartTran WHERE PartTran.Company = CUR-COMP AND PartTran.JobNum = ttPartTran.JobNum AND PartTran.TranType = ‘MFG-STK’ NO-LOCK.
QtyReceived = QtyReceived + PartTran.TranQty.
END.

ASSIGN TextMessage = ‘This receipt quantity of ’ + STRING(ttPartTran.TranQty) + ’ will make a total receipt quantity of ’ + STRING(QtyReceived + ttPartTran.TranQty) + ’ exceeding the job’'s production quantity.of ’ + STRING(ProdQty).

IF (QtyReceived + ttPartTran.TranQty) > ProdQty THEN DO:
{lib\PublishEx.i &exMsg = "TextMessage "}
{&THROW_PUBLIC}.
END.

END.

1 Like

That works a treat Ross. thanks for that…

If i wanted to add to this code InfoSeverity = {&MESSAGE_ERR}}.

Could i add it here - {lib\PublishEx.i &exMsg = "TextMessage "}

Lee,

I think you can use it like the following:

{lib\PublishEx.i &exMsg = “TextMessage” &ExType = {&MESSAGE_ERR}}

Ross

I have tried various combination to try and stop the transaction from happening , but it seems to just display the warning messaging and i can still carry on moving the job to inventory.

Just make sure you have the following at the end…

/Code for Exception Message …/
{lib\PublishEx.i &exMsg = “TextMessage”}
{&THROW_PUBLIC}. /<— Needed for throwing an exception message, not needed for an informational message./

Also, make sure that is the correct object/method in E9. It is in E10 but I don’t have access to E9 to verify.

Ross

To go back to what @jeowings said about tracing, I traced a transaction and when you enter the quantity ReceiptsFromMfg.OnChangeActTranQty is called and ActTranQty holds the value entered. If you throw the exception there then the quantity entered will never be over.

Here is the snipit I always use in an abl exception.

EXCEPTION

define variable Msg as character init ''.
Msg = "Employee " + EmpBasic.EmpID.
	
			{lib/PublishEx.i &ExMsg = Msg &ExType = {&MESSAGE_ERR}}.