BPM to stop the receiving of unapproved/held/pending Purchase Order

Hello:
I am a epicor new user .I need a BMP to BPM to stop the receiving of unapproved/held/pending Purchase Order, I search the form and found A ABL code is right for .and I use a epicor abl to C# translate it .when i input to the BPM, it seems not working .can anyone help about this ? thanks.
ABL CODE:

FIND FIRST ttRcvHead WHERE ttRcvHead.RowMod = “A” NO-LOCK NO-ERROR.

FIND FIRST POHeader where POHeader.company = ttRcvHead.company and POHeader.poNum = ttRcvHead.poNum NO-LOCK NO-ERROR.

/IF POHeader.ApprovalStatus <> “A” THEN/

Case POHeader.ApprovalStatus:

WHEN “U” THEN

{Lib/PublishEx.i &ExMsg = “‘PO has not been submitted for approval. Please submit for approval before receiving PO.’”}

WHEN “P” THEN

{Lib/PublishEx.i &ExMsg = “‘PO has not been approved. Please approve PO before receiving.’”}

WHEN “R” THEN

{Lib/PublishEx.i &ExMsg = “‘PO has been rejected. PO cannot be received.’”}

END CASE.

Transate to C#:
Erp.Tables.POHeader POHeader;
var ttRcvHead_xRow = (from ttRcvHead_Row in ttRcvHead
where string.Equals(ttRcvHead_Row.RowMod, IceRow.ROWSTATE_ADDED, StringComparison.OrdinalIgnoreCase)
select ttRcvHead_Row).FirstOrDefault();
POHeader = (from POHeader_Row in Db.POHeader
where string.Compare(POHeader_Row.Company, ttRcvHead_xRow.Company, true) == 0 && POHeader_Row.PONum == ttRcvHead_xRow.PONum
select POHeader_Row).FirstOrDefault();
switch (POHeader.ApprovalStatus)
{
case “U”:
{
CallContext.Current.ExceptionManager.AddBLException(“PO has not been submitted for approval. Please submit for approval before receiving PO.”);
}
break;
case “P”:
{
CallContext.Current.ExceptionManager.AddBLException(“PO has not been approved. Please approve PO before receiving.”);
}
break;
case “R”:
{
CallContext.Current.ExceptionManager.AddBLException(“PO has been rejected. PO cannot be received.”);
}
break;
}

When you say it’s not working, do you mean it doesn’t compile (you get error messages when trying to save it) or does it not behave the way you intended it to?

sorry. I already found the problem .the code is working now

I am a epicor new user .can you tell me how to implement this function? Thank you very much and I wish you a happy day

From 10.1.400 onwards, the system already has standard functionality, and you can enable it directly without any additional BPM.
Go to System Setup–>Company/Site Maintenance–>Company Configuration

2 Likes