Thanks Aaron, do you have an example of the syntax for this, I am new to BAM
and what I have written below is my most complex BAM to date and involved
much blood, sweat and tears to get it to this point.
John
-----Original Message-----
From:
vantage@yahoogroups.com [mailto:
vantage@yahoogroups.com] On Behalf Of
Aaron Hoyt
Sent: Friday, 10 March 2006 1:36 AM
To:
vantage@yahoogroups.com
Subject: RE: [Vantage] Help with BAM
John,
In the first Find InvcDtl, wouldn't you want to set up a FOR EACH loop to
evaluate each of the detail lines?
I think I would do it with a numeric variable initialized to 0 and have it
add one for each detail line it finds and evaluates. Later, test the value
of the variable and if it's 0, cancel, if not, process the rest of the rules
for sending the email.
Just my thoughts, take it with a grain of salt.
Aaron Hoyt
Vantage Plastics
-----Original Message-----
From:
vantage@yahoogroups.com [mailto:
vantage@yahoogroups.com]On Behalf
Of John Walter
Sent: Wednesday, March 08, 2006 6:57 PM
To:
vantage@yahoogroups.com
Subject: [Vantage] Help with BAM
Hi all,
A challenge for the BAM experts out there. I have written a BAM .p program
to send an email to our Service Division people when an invoice is created
for our main products. It works fine when the invoice only has one line but
falls over if there is more than one line. I think the problem is my outer
join to the ShipTo table but nan't see a way around it. See code below, any
suggestions welcome
{ud/GlbAlert.i &TableName = "InvcHead"}
DEFINE VARIABLE Plant AS CHARACTER NO-UNDO.
DEFINE VARIABLE Project AS CHARACTER NO-UNDO.
FIND Mfgsys.InvcDtl Where (Mfgsys.InvcDtl.Company = Mfgsys.InvcHead.Company)
AND
(Mfgsys.InvcDtl.InvoiceNum = Mfgsys.InvcHead.InvoiceNum) NO-LOCK NO-ERROR.
IF NOT AVAILABLE Mfgsys.InvcDtl THEN DO:
RETURN "Cancel Send".
END.
FIND Mfgsys.Customer Where (Mfgsys.Customer.Company =
Mfgsys.InvcHead.Company) AND
(Mfgsys.Customer.CustNum = Mfgsys.InvcHead.CustNum) NO-LOCK NO-ERROR.
IF NOT AVAILABLE Mfgsys.Customer THEN DO:
RETURN "Cancel Send".
END.
FIND Mfgsys.ShipTo OUTER-JOIN NO-LOCK Where (Mfgsys.ShipTo.Company =
Mfgsys.InvcDtl.Company) AND
(Mfgsys.ShipTo.CustNum = Mfgsys.InvcDtl.CustNum) AND
(Mfgsys.ShipTo.ShipToNum = Mfgsys.InvcDtl.ShipToNum) NO-ERROR.
IF NOT AVAILABLE Mfgsys.ShipTo THEN DO:
RETURN "Cancel Send".
END.
Plant = Mfgsys.InvcHead.Plant.
Project = Mfgsys.InvcHead.InvoiceComment.
IF Mfgsys.InvcHead.Posted = No THEN DO:
RETURN "Cancel Send":U.
END.
IF Mfgsys.InvcHead.InvoiceType <> "Shp" THEN DO:
RETURN "Cancel Send":U.
END.
IF Mfgsys.InvcHead.LineType = "Call" THEN DO:
RETURN "Cancel Send":U.
END.
IF Mfgsys.InvcHead.Plant = "BBK" THEN DO:
RETURN "Cancel Send":U.
END.
ELSE DO:
ASSIGN Email-Subject = "New Service Opportunity".
ASSIGN Email-Text = "Invoice No. " + string(InvcHead.InvoiceNum) + " has
just been raised for " + Project + ". Refer Sales Order " +
string(InvcDtl.OrderNum) + "~n~n"
+ "Customer is " + Customer.Name + "~n"
+ "Ship To Address1 - " + ShipTo.Address1 + "~n"
+ "Ship To Address2 - " + ShipTo.Address2 + "~n"
+ "Ship To Address3 - " + ShipTo.Address3 + "~n"
+ "City/State - " + ShipTo.City + " " + ShipTo.State.
CASE Plant:
WHEN "BBK" THEN
Email-To = "
aaa@...".
WHEN "QLD" THEN
Email-To = "
bbb@...".
WHEN "SA" THEN
Email-To = "
ccc@...".
WHEN "GLASS" THEN
Email-To =
david.l@....
WHEN "WA" THEN
Email-To = "
ddd@...".
WHEN "NSW" THEN
Email-To = "
eee@...".
WHEN "VSO" THEN
Email-To = "
fff@...".
END CASE.
CASE Plant:
WHEN "QLD" THEN
Email-CC = "
serviceqld@...".
WHEN "NSW" THEN
Email-CC = "
servicensw@...".
END CASE.
END.
John Walter | National IS Advisor | Hufcor Pty Ltd
5-7 Trade Park Drive, Tullamarine, Victoria. 3250
Phone +613 9330 3733 | Fax +613 9338 9015
www.hufcor.com.au <
http://www.hufcor.com.au/>
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/links
Yahoo! Groups Links
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/links
Yahoo! Groups Links