Illegal nested block statement

Greg,

Thanks so much, that looks great. I've put it in our Test environment and will play with it.

What I'm really looking for is the syntax for the ShipDtl For/Next loop so I can add part numbers and quantities. As I have it now, each ShipDtl line triggers its own email, so a customer could conceivably get dozens of emails on a single shipment. We don't usually ship that many, but even 3 or 4 can get annoying after a bit.

Thanks again, and Happy Holidays!

Ernie

--- In vantage@yahoogroups.com, Greg Payne <gpayne@...> wrote:
>
> Ernie:
>
> this looks similar to the Advance Email bpm that I got from support and posted to files this week. I didn't actually run it, just took the parts I needed.
>
> I will enable it and test it later this evening.
>
> You may want to install theirs and see if it will run for you, then start tweaking from there.
>
> I also have an email example .p program that runs from an alert, so it is not a data directive, but triggers much the same.
>
> Greg
>
>
>
> From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of bw2868bond
> Sent: Wednesday, December 21, 2011 4:56 PM
> To: vantage@yahoogroups.com
> Subject: [Vantage] Re: Illegal nested block statement
>
>
>
> Without seeing the rest of the code it will be difficult to diagnose.
> You are referencing 4 different tables and no code shows where the data for each table comes from.....
>
> --- In vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>, "Elizabeth" <gracefulthreads@<mailto:gracefulthreads@>> wrote:
> >
> > I'm sure the following code is used by many. I'm trying to customize it to send an email to a customer when their order ships. I have a version of it working now as a Data Directive on the OrderRel table that triggers when the OurJobShippedQty or OurStockShippedQty values are changed, but according to Epicor support having emails in Data Directive BPMs is not supported. Ergo I want to put this on the CustShip.Update Method to trigger when the ShipHead.ReadyToInvoice flag is set.
> >
> > The sticking point is the "For Each ShipDtl no-lock" loop... I get an "Illegal nested block statement reference". I'm not a programmer, and I have no idea how to do this correctly. Any help would be greatly appreciated!
> >
> > *******
> >
> > define variable mFrom as character.
> > define variable mTo as character.
> > define variable mCc as character.
> > define variable mSubject as character.
> > define variable mBody as character.
> > define variable mhEmailProc as handle no-undo.
> >
> > run Bpm/BpmEmail.p persistent set mhEmailProc.
> >
> > assign mTo = (email address)
> > mFrom = (email address)
> > mCc = (email address)
> > mSubject = 'Order has shipped!'
> > mBody = 'Your PO Number : ' + PONum +
> > '~nShip Date : ' + string(ttShipHead.ShipDate) +
> > '~nPack Slip : ' + string(ttShipHead.Packnum).
> > '~nOrder Number : ' + string(OrderRel.OrderNum).
> >
> > FOR EACH ShipDtl no-lock.
> > DO:
> > '~nYour Part Number : ' + OrderDtl.XPartNum +
> > '~nQuantity : ' + string(ShipDtl.SellingInventoryShipQty + ShipDtl.SellingJobShipQty) + ' ' + ShipDtl.SalesUM + ' has shipped.' +
> > '~n~n'.
> > END.
> > END.
> >
> > run SendEmail in mhEmailProc (
> > false,
> > CUR-COMP,
> > mFrom,
> > mTo,
> > mCc,
> > mSubject,
> > mBody,
> > "":U
> > ).
> > if valid-handle( mhEmailProc) then delete procedure mhEmailProc.
> > leave.
> > end.
> >
> > ********
> >
> > Thanks,
> >
> > Ernie Lowell
> > Diba Industries
> >
>
>
> ________________________________
> CONFIDENTIALITY NOTICE
>
> The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us at (727) 578-6258 and immediately delete the communication.
>
> "This (document/presentation) may contain technical data as defined in the International Traffic In Arms Regulations (ITAR) 22 CFR 120.10. Export of this material is restricted by the Arms Export Control Act (22 U.S.C. 2751 et seq.) and may not be exported to foreign persons without prior approval form the U.S. Department of State."
>
>
> [Non-text portions of this message have been removed]
>
I'm sure the following code is used by many. I'm trying to customize it to send an email to a customer when their order ships. I have a version of it working now as a Data Directive on the OrderRel table that triggers when the OurJobShippedQty or OurStockShippedQty values are changed, but according to Epicor support having emails in Data Directive BPMs is not supported. Ergo I want to put this on the CustShip.Update Method to trigger when the ShipHead.ReadyToInvoice flag is set.

The sticking point is the "For Each ShipDtl no-lock" loop... I get an "Illegal nested block statement reference". I'm not a programmer, and I have no idea how to do this correctly. Any help would be greatly appreciated!

*******

define variable mFrom as character.
define variable mTo as character.
define variable mCc as character.
define variable mSubject as character.
define variable mBody as character.
define variable mhEmailProc as handle no-undo.

run Bpm/BpmEmail.p persistent set mhEmailProc.

assign mTo = (email address)
mFrom = (email address)
mCc = (email address)
mSubject = 'Order has shipped!'
mBody = 'Your PO Number : ' + PONum +
'~nShip Date : ' + string(ttShipHead.ShipDate) +
'~nPack Slip : ' + string(ttShipHead.Packnum).
'~nOrder Number : ' + string(OrderRel.OrderNum).

FOR EACH ShipDtl no-lock.
DO:
'~nYour Part Number : ' + OrderDtl.XPartNum +
'~nQuantity : ' + string(ShipDtl.SellingInventoryShipQty + ShipDtl.SellingJobShipQty) + ' ' + ShipDtl.SalesUM + ' has shipped.' +
'~n~n'.
END.
END.

run SendEmail in mhEmailProc (
false,
CUR-COMP,
mFrom,
mTo,
mCc,
mSubject,
mBody,
"":U
).
if valid-handle( mhEmailProc) then delete procedure mhEmailProc.
leave.
end.

********

Thanks,

Ernie Lowell
Diba Industries
Without seeing the rest of the code it will be difficult to diagnose.
You are referencing 4 different tables and no code shows where the data for each table comes from.....

--- In vantage@yahoogroups.com, "Elizabeth" <gracefulthreads@...> wrote:
>
> I'm sure the following code is used by many. I'm trying to customize it to send an email to a customer when their order ships. I have a version of it working now as a Data Directive on the OrderRel table that triggers when the OurJobShippedQty or OurStockShippedQty values are changed, but according to Epicor support having emails in Data Directive BPMs is not supported. Ergo I want to put this on the CustShip.Update Method to trigger when the ShipHead.ReadyToInvoice flag is set.
>
> The sticking point is the "For Each ShipDtl no-lock" loop... I get an "Illegal nested block statement reference". I'm not a programmer, and I have no idea how to do this correctly. Any help would be greatly appreciated!
>
> *******
>
> define variable mFrom as character.
> define variable mTo as character.
> define variable mCc as character.
> define variable mSubject as character.
> define variable mBody as character.
> define variable mhEmailProc as handle no-undo.
>
> run Bpm/BpmEmail.p persistent set mhEmailProc.
>
> assign mTo = (email address)
> mFrom = (email address)
> mCc = (email address)
> mSubject = 'Order has shipped!'
> mBody = 'Your PO Number : ' + PONum +
> '~nShip Date : ' + string(ttShipHead.ShipDate) +
> '~nPack Slip : ' + string(ttShipHead.Packnum).
> '~nOrder Number : ' + string(OrderRel.OrderNum).
>
> FOR EACH ShipDtl no-lock.
> DO:
> '~nYour Part Number : ' + OrderDtl.XPartNum +
> '~nQuantity : ' + string(ShipDtl.SellingInventoryShipQty + ShipDtl.SellingJobShipQty) + ' ' + ShipDtl.SalesUM + ' has shipped.' +
> '~n~n'.
> END.
> END.
>
> run SendEmail in mhEmailProc (
> false,
> CUR-COMP,
> mFrom,
> mTo,
> mCc,
> mSubject,
> mBody,
> "":U
> ).
> if valid-handle( mhEmailProc) then delete procedure mhEmailProc.
> leave.
> end.
>
> ********
>
> Thanks,
>
> Ernie Lowell
> Diba Industries
>
Ernie:

this looks similar to the Advance Email bpm that I got from support and posted to files this week. I didn't actually run it, just took the parts I needed.

I will enable it and test it later this evening.

You may want to install theirs and see if it will run for you, then start tweaking from there.

I also have an email example .p program that runs from an alert, so it is not a data directive, but triggers much the same.

Greg



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of bw2868bond
Sent: Wednesday, December 21, 2011 4:56 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Illegal nested block statement



Without seeing the rest of the code it will be difficult to diagnose.
You are referencing 4 different tables and no code shows where the data for each table comes from.....

--- In vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>, "Elizabeth" <gracefulthreads@...<mailto:gracefulthreads@...>> wrote:
>
> I'm sure the following code is used by many. I'm trying to customize it to send an email to a customer when their order ships. I have a version of it working now as a Data Directive on the OrderRel table that triggers when the OurJobShippedQty or OurStockShippedQty values are changed, but according to Epicor support having emails in Data Directive BPMs is not supported. Ergo I want to put this on the CustShip.Update Method to trigger when the ShipHead.ReadyToInvoice flag is set.
>
> The sticking point is the "For Each ShipDtl no-lock" loop... I get an "Illegal nested block statement reference". I'm not a programmer, and I have no idea how to do this correctly. Any help would be greatly appreciated!
>
> *******
>
> define variable mFrom as character.
> define variable mTo as character.
> define variable mCc as character.
> define variable mSubject as character.
> define variable mBody as character.
> define variable mhEmailProc as handle no-undo.
>
> run Bpm/BpmEmail.p persistent set mhEmailProc.
>
> assign mTo = (email address)
> mFrom = (email address)
> mCc = (email address)
> mSubject = 'Order has shipped!'
> mBody = 'Your PO Number : ' + PONum +
> '~nShip Date : ' + string(ttShipHead.ShipDate) +
> '~nPack Slip : ' + string(ttShipHead.Packnum).
> '~nOrder Number : ' + string(OrderRel.OrderNum).
>
> FOR EACH ShipDtl no-lock.
> DO:
> '~nYour Part Number : ' + OrderDtl.XPartNum +
> '~nQuantity : ' + string(ShipDtl.SellingInventoryShipQty + ShipDtl.SellingJobShipQty) + ' ' + ShipDtl.SalesUM + ' has shipped.' +
> '~n~n'.
> END.
> END.
>
> run SendEmail in mhEmailProc (
> false,
> CUR-COMP,
> mFrom,
> mTo,
> mCc,
> mSubject,
> mBody,
> "":U
> ).
> if valid-handle( mhEmailProc) then delete procedure mhEmailProc.
> leave.
> end.
>
> ********
>
> Thanks,
>
> Ernie Lowell
> Diba Industries
>


________________________________
CONFIDENTIALITY NOTICE

The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us at (727) 578-6258 and immediately delete the communication.

"This (document/presentation) may contain technical data as defined in the International Traffic In Arms Regulations (ITAR) 22 CFR 120.10. Export of this material is restricted by the Arms Export Control Act (22 U.S.C. 2751 et seq.) and may not be exported to foreign persons without prior approval form the U.S. Department of State."


[Non-text portions of this message have been removed]
Theirs works, so if you install it, I will help you with the content.

Greg

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Greg Payne
Sent: Wednesday, December 21, 2011 5:15 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Re: Illegal nested block statement



Ernie:

this looks similar to the Advance Email bpm that I got from support and posted to files this week. I didn't actually run it, just took the parts I needed.

I will enable it and test it later this evening.

You may want to install theirs and see if it will run for you, then start tweaking from there.

I also have an email example .p program that runs from an alert, so it is not a data directive, but triggers much the same.

Greg

From: vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com> [mailto:vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>] On Behalf Of bw2868bond
Sent: Wednesday, December 21, 2011 4:56 PM
To: vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com>
Subject: [Vantage] Re: Illegal nested block statement

Without seeing the rest of the code it will be difficult to diagnose.
You are referencing 4 different tables and no code shows where the data for each table comes from.....

--- In vantage@yahoogroups.com<mailto:vantage%40yahoogroups.com><mailto:vantage%40yahoogroups.com>, "Elizabeth" <gracefulthreads@...<mailto:gracefulthreads@...<mailto:gracefulthreads@...%3cmailto:gracefulthreads@...>>> wrote:
>
> I'm sure the following code is used by many. I'm trying to customize it to send an email to a customer when their order ships. I have a version of it working now as a Data Directive on the OrderRel table that triggers when the OurJobShippedQty or OurStockShippedQty values are changed, but according to Epicor support having emails in Data Directive BPMs is not supported. Ergo I want to put this on the CustShip.Update Method to trigger when the ShipHead.ReadyToInvoice flag is set.
>
> The sticking point is the "For Each ShipDtl no-lock" loop... I get an "Illegal nested block statement reference". I'm not a programmer, and I have no idea how to do this correctly. Any help would be greatly appreciated!
>
> *******
>
> define variable mFrom as character.
> define variable mTo as character.
> define variable mCc as character.
> define variable mSubject as character.
> define variable mBody as character.
> define variable mhEmailProc as handle no-undo.
>
> run Bpm/BpmEmail.p persistent set mhEmailProc.
>
> assign mTo = (email address)
> mFrom = (email address)
> mCc = (email address)
> mSubject = 'Order has shipped!'
> mBody = 'Your PO Number : ' + PONum +
> '~nShip Date : ' + string(ttShipHead.ShipDate) +
> '~nPack Slip : ' + string(ttShipHead.Packnum).
> '~nOrder Number : ' + string(OrderRel.OrderNum).
>
> FOR EACH ShipDtl no-lock.
> DO:
> '~nYour Part Number : ' + OrderDtl.XPartNum +
> '~nQuantity : ' + string(ShipDtl.SellingInventoryShipQty + ShipDtl.SellingJobShipQty) + ' ' + ShipDtl.SalesUM + ' has shipped.' +
> '~n~n'.
> END.
> END.
>
> run SendEmail in mhEmailProc (
> false,
> CUR-COMP,
> mFrom,
> mTo,
> mCc,
> mSubject,
> mBody,
> "":U
> ).
> if valid-handle( mhEmailProc) then delete procedure mhEmailProc.
> leave.
> end.
>
> ********
>
> Thanks,
>
> Ernie Lowell
> Diba Industries
>

________________________________
CONFIDENTIALITY NOTICE

The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us at (727) 578-6258 and immediately delete the communication.

"This (document/presentation) may contain technical data as defined in the International Traffic In Arms Regulations (ITAR) 22 CFR 120.10. Export of this material is restricted by the Arms Export Control Act (22 U.S.C. 2751 et seq.) and may not be exported to foreign persons without prior approval form the U.S. Department of State."

[Non-text portions of this message have been removed]


________________________________
CONFIDENTIALITY NOTICE

The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us at (727) 578-6258 and immediately delete the communication.

"This (document/presentation) may contain technical data as defined in the International Traffic In Arms Regulations (ITAR) 22 CFR 120.10. Export of this material is restricted by the Arms Export Control Act (22 U.S.C. 2751 et seq.) and may not be exported to foreign persons without prior approval form the U.S. Department of State."


[Non-text portions of this message have been removed]