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;
}