Here's some 4GL Code that will do it:
{ud/GlbAlert.i &TableName = "POHeader"}
DEFINE VARIABLE POAmount AS DECIMAL NO-UNDO.
DEFINE VARIABLE PONumber AS DECIMAL NO-UNDO.
DEFINE VARIABLE Company AS CHARACTER NO-UNDO.
DEFINE VARIABLE ApprovalStatus AS CHARACTER NO-UNDO.
PONumber = POHeader.PONum.
Company = POHeader.Company.
ApprovalStatus = POHeader.ApprovalStatus.
message "PONum: " + string(PONumber) + "~n".
message "ApprovalStatus: " + ApprovalStatus + "~n".
find PODetail where (PODetail.Company = POHeader.Company) and (PODetail.PONum = POHeader.PONum) no-lock no-error.
for each PODetail of POHeader:
POAmount = POAmount + (PODetail.DocUnitCost * PODetail.OrderQty).
end.
find POApvMsg where (POApvMsg.Company = POHeader.Company) and (POApvMsg.PONum = POHeader.PONum)
and POApvMsg.MsgType = "1" no-lock no-error.
if available POApvMsg then do:
message "PONum: " + string(POApvMsg.PONum) + " MsgTo: " + POApvMsg.MsgTo.
find PurAgent where (PurAgent.Company = POHeader.Company) and (PurAgent.BuyerId = POApvMsg.MsgTo) no-lock no-error.
if available PurAgent then do:
find Vendor where (Vendor.Company = POHeader.Company) and (Vendor.VendorNum = POHeader.VendorNum) no-lock no-error.
if available Vendor then do:
message "Approver E-Mail: " + PurAgent.EmailAddress.
message "Vendor: " + Vendor.Name + " (" + Vendor.VendorID + ")".
Assign Email-From = "
vantage-alerts@...".
Assign Email-To = PurAgent.EmailAddress.
Assign Email-Subject = POHeader.Company + " Purchase Order Approval Status Notification".
Assign Email-Text = "Purchase Order " + string(POHeader.PONum) + " has been approved.~n"
+ "----------~n"
+ "Company: " + POHeader.Company + "~n"
+ "Vendor: " + Vendor.Name + " (" + Vendor.VendorID + ")~n"
+ "POAmount: " + TRIM(string(POAmount, "$>>>,>>>,>>9.99")) + "~n"
+ "Buyer: " + POHeader.BuyerID + "~n"
+ "PODate: " + string(POHeader.OrderDate) + "~n"
+ "Approver: " + PurAgent.Name + " [" + PurAgent.BuyerID + "] <" + PurAgent.EmailAddress + ">~n"
+ "Comments: ~n" + POHeader.CommentText + "~n".
if (POApvMsg.MsgText <> "") then do:
Assign Email-Text = Email-Text + "Approval Message Log: ~n" + POApvMsg.MsgText + "~n".
end.
message "Email-Text: " + Email-Text.
end.
end.
end.
Save this in your mfgsys803\server\ud folder as a .P file, and point to it in your BAM. If you do a BAM alert on the POHeader.ApprovalStatus field and filter on ApprovalStatus = 'A' you should get what you expect: buyers will get notified when their POs have been approved.
I also developed a more complete solution so that approvers also get notified all the way up the approval chain, and then the buyer gets notified at the end.
-bws
--
Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
   Â
bspolarich@... ~ 734-864-5618 ~ www.advancedphotonix.com
-----Original Message-----
From:
vantage@yahoogroups.com [mailto:
vantage@yahoogroups.com] On Behalf Of Cheryl Elliott
Sent: Friday, October 16, 2009 10:46 AM
To:
vantage@yahoogroups.com
Subject: [Vantage] Include specific info on BAM Alerts
We are implementing the approval system for Purchase Orders, and want the system to alert the buyer whenever a PO has been approved. The BAM works properly, but does not include the PO number and the buyers would like to have the particular PO referenced in their alerts. Any ideas? I see there is the possibility of triggering an "Additional Alert Program" but with my limited programming skills, I can't imagine anything helpful coming from "outside" that way...
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links