Data Directive BPM - Need some ABL code help

Maybe then create a UD field that you can check if the order meets your criteria.  That way you would only have to run the full code until it becomes positive, and a shorter version per se if it is.  I think you want the BPM to be a Post BPM.

 

 

Brenda

 

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Monday, February 01, 2016 4:18 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Data Directive BPM - Need some ABL code help

 

 

Hi Brenda,

 

Thanks for the response. This is going on the OrderRel table as an "In-Transaction" BPM. Earlier I said it was a "Standard" BPM but I was wrong, it is an In-Transaction BPM. The reason I think I need this to do this with code is that I need it to execute for each Order Release on an order if any OrderDtl meets the criteria. So if the third line of an order has a part number which begins "GDS", I need to look at the releases on the first 2 lines of the order to see if those have product groups which receive commission. I thought of doing this as a Post-Processing Method Directive on the BO "Quote", Method "CreateOrder" but then I still have to deal with the issue of additional releases being added after the initial order creation. Additionally, if a line with part number beginning with "GDS" is added later I would like the code to run to assign the rep to the appropriate releases. I guess I could put method directives on the "SalesOrder" BO to execute code to look at all the lines each time a release is added or updated but that seems to be messier...



---In vantage@yahoogroups.com, <brenda@...> wrote :

What BO are you putting this on?  Do you really need code.  Seems like you might be able to do this with a few conditions and then a set action.  But if you want to do it in code, I would suggest not going from the release to the detail to the release to the detail.  Because there could be many OrderRel to an OrderDtl, I would check the condition on the OrderDtl first and then go onto the OrderRel.  Also make sure to RELEASE the table you lock.

 

Example:

 

FIND FIRST Resource WHERE (Resource.Company = CUR-COMP) AND (Resource.ResourceID = ttCallContextBpmData.ShortChar01) exclusive-lock.

 

      IF AVAILABLE Resource THEN DO:

 

         Assign Resource.Inactive = TRUE.

 

      END.   RELEASE RESOURCE.

 

 

Brenda

 

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Monday, February 01, 2016 1:20 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Data Directive BPM - Need some ABL code help

 

 

Hey Everyone,

 

I am working on getting a BPM going which will automatically assign the sales rep to an order release if the applicable product is on the order. I am using a OrderRel.Character01 to hold this information as this is separate from the salesperson assigned to an order. 

 

If any order line has a part number starting with "GDS" I want to assign the rep to all lines with part numbers starting with "GDS" or having a product group begin with "ECBL" or "PCBL". The following code seems to drill down to the correct level but it fails to assign the value to character01 in all situations and in the case where the part number begins with "GDS", EPICOR fails to create the line when done from the create sales order wizard in quote entry. 

 

I have this code placed in a Standard Data Directive on the OrderRel Table.

 

Any ideas on what I am doing wrong??

 

 

For Each ttOrderRel:

Find First OrderDtl where OrderDtl.OrderNum = ttOrderRel.OrderNum and OrderDtl.PartNum BEGINS "GDS" No-Lock No-Error.

If Avail OrderDtl or ttOrderRel.PartNum BEGINS "GDS" then DO:

For Each OrderRel where OrderRel.OrderNum = ttOrderRel.OrderNum Exclusive-Lock:

Find First OrderDtl where OrderDtl.OrderNum = OrderRel.OrderNum and OrderDtl.OrderLine = OrderRel.OrderLine No-Lock No-Error.

If Avail OrderDtl and (OrderRel.PartNum BEGINS "GDS" or OrderDtl.ProdCode = "PCBL" or OrderDtl.ProdCode = "ECBL") then DO:

Assign OrderRel.Character01 = "TST".

End. /*DO*/

End. /*For Each OrderRel*/

End. /*DO*/

End. /*Each ttOrderRel*/

 

 

Hey Everyone,


I am working on getting a BPM going which will automatically assign the sales rep to an order release if the applicable product is on the order. I am using a OrderRel.Character01 to hold this information as this is separate from the salesperson assigned to an order. 


If any order line has a part number starting with "GDS" I want to assign the rep to all lines with part numbers starting with "GDS" or having a product group begin with "ECBL" or "PCBL". The following code seems to drill down to the correct level but it fails to assign the value to character01 in all situations and in the case where the part number begins with "GDS", EPICOR fails to create the line when done from the create sales order wizard in quote entry. 


I have this code placed in a Standard Data Directive on the OrderRel Table.


Any ideas on what I am doing wrong??



For Each ttOrderRel:
Find First OrderDtl where OrderDtl.OrderNum = ttOrderRel.OrderNum and OrderDtl.PartNum BEGINS "GDS" No-Lock No-Error.
If Avail OrderDtl or ttOrderRel.PartNum BEGINS "GDS" then DO:
For Each OrderRel where OrderRel.OrderNum = ttOrderRel.OrderNum Exclusive-Lock:
Find First OrderDtl where OrderDtl.OrderNum = OrderRel.OrderNum and OrderDtl.OrderLine = OrderRel.OrderLine No-Lock No-Error.
If Avail OrderDtl and (OrderRel.PartNum BEGINS "GDS" or OrderDtl.ProdCode = "PCBL" or OrderDtl.ProdCode = "ECBL") then DO:
Assign OrderRel.Character01 = "TST".
End. /*DO*/
End. /*For Each OrderRel*/
End. /*DO*/

End. /*Each ttOrderRel*/


 

By the way this is in 9.05.701

What BO are you putting this on?  Do you really need code.  Seems like you might be able to do this with a few conditions and then a set action.  But if you want to do it in code, I would suggest not going from the release to the detail to the release to the detail.  Because there could be many OrderRel to an OrderDtl, I would check the condition on the OrderDtl first and then go onto the OrderRel.  Also make sure to RELEASE the table you lock.

 

Example:

 

FIND FIRST Resource WHERE (Resource.Company = CUR-COMP) AND (Resource.ResourceID = ttCallContextBpmData.ShortChar01) exclusive-lock.

 

      IF AVAILABLE Resource THEN DO:

 

         Assign Resource.Inactive = TRUE.

 

      END.   RELEASE RESOURCE.

 

 

Brenda

 

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Monday, February 01, 2016 1:20 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Data Directive BPM - Need some ABL code help

 

 

Hey Everyone,

 

I am working on getting a BPM going which will automatically assign the sales rep to an order release if the applicable product is on the order. I am using a OrderRel.Character01 to hold this information as this is separate from the salesperson assigned to an order. 

 

If any order line has a part number starting with "GDS" I want to assign the rep to all lines with part numbers starting with "GDS" or having a product group begin with "ECBL" or "PCBL". The following code seems to drill down to the correct level but it fails to assign the value to character01 in all situations and in the case where the part number begins with "GDS", EPICOR fails to create the line when done from the create sales order wizard in quote entry. 

 

I have this code placed in a Standard Data Directive on the OrderRel Table.

 

Any ideas on what I am doing wrong??

 

 

For Each ttOrderRel:

Find First OrderDtl where OrderDtl.OrderNum = ttOrderRel.OrderNum and OrderDtl.PartNum BEGINS "GDS" No-Lock No-Error.

If Avail OrderDtl or ttOrderRel.PartNum BEGINS "GDS" then DO:

For Each OrderRel where OrderRel.OrderNum = ttOrderRel.OrderNum Exclusive-Lock:

Find First OrderDtl where OrderDtl.OrderNum = OrderRel.OrderNum and OrderDtl.OrderLine = OrderRel.OrderLine No-Lock No-Error.

If Avail OrderDtl and (OrderRel.PartNum BEGINS "GDS" or OrderDtl.ProdCode = "PCBL" or OrderDtl.ProdCode = "ECBL") then DO:

Assign OrderRel.Character01 = "TST".

End. /*DO*/

End. /*For Each OrderRel*/

End. /*DO*/

End. /*Each ttOrderRel*/

 

 

Hi Brenda,

Thanks for the response. This is going on the OrderRel table as an "In-Transaction" BPM. Earlier I said it was a "Standard" BPM but I was wrong, it is an In-Transaction BPM. The reason I think I need this to do this with code is that I need it to execute for each Order Release on an order if any OrderDtl meets the criteria. So if the third line of an order has a part number which begins "GDS", I need to look at the releases on the first 2 lines of the order to see if those have product groups which receive commission. I thought of doing this as a Post-Processing Method Directive on the BO "Quote", Method "CreateOrder" but then I still have to deal with the issue of additional releases being added after the initial order creation. Additionally, if a line with part number beginning with "GDS" is added later I would like the code to run to assign the rep to the appropriate releases. I guess I could put method directives on the "SalesOrder" BO to execute code to look at all the lines each time a release is added or updated but that seems to be messier...


---In vantage@yahoogroups.com, <brenda@...> wrote :

#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {font-family:Wingdings;panose-1:5 0 0 0 0 0 0 0 0 0;} #ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {font-family:Wingdings;panose-1:5 0 0 0 0 0 0 0 0 0;} #ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;} #ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;} #ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {font-family:Consolas;panose-1:2 11 6 9 2 2 4 3 2 4;} #ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {font-family:"Microsoft Sans Serif";panose-1:2 11 6 4 2 2 2 2 2 4;} #ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {font-family:Verdana;panose-1:2 11 6 4 3 5 4 4 2 4;} #ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {font-family:"Comic Sans MS";panose-1:3 15 7 2 3 3 2 2 2 4;} #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 #ygrps-yiv-331318111ygrps-yiv-27622187 p.ygrps-yiv-331318111ygrps-yiv-27622187MsoNormal, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 li.ygrps-yiv-331318111ygrps-yiv-27622187MsoNormal, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 div.ygrps-yiv-331318111ygrps-yiv-27622187MsoNormal {margin:0in;margin-bottom:.0001pt;font-size:12.0pt;font-family:"Times New Roman", "serif";} #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 a:link, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 span.ygrps-yiv-331318111ygrps-yiv-27622187MsoHyperlink { color:blue;text-decoration:underline;} #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 a:visited, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 span.ygrps-yiv-331318111ygrps-yiv-27622187MsoHyperlinkFollowed { color:purple;text-decoration:underline;} #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 p {

margin-right:0in;margin-left:0in;font-size:12.0pt;font-family:“Times New Roman”, “serif”;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 code
{
font-family:“Courier New”;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 pre
{

margin:0in;margin-bottom:.0001pt;font-size:10.0pt;font-family:“Courier New”;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 tt
{
font-family:“Courier New”;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 span.ygrps-yiv-331318111ygrps-yiv-27622187cat
{}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 span.ygrps-yiv-331318111ygrps-yiv-27622187ct
{}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 span.ygrps-yiv-331318111ygrps-yiv-27622187HTMLPreformattedChar
{

font-family:Consolas;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 p.ygrps-yiv-331318111ygrps-yiv-27622187attach, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 li.ygrps-yiv-331318111ygrps-yiv-27622187attach, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 div.ygrps-yiv-331318111ygrps-yiv-27622187attach
{

margin-right:0in;margin-left:0in;font-size:9.0pt;font-family:“Arial”, “sans-serif”;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 p.ygrps-yiv-331318111ygrps-yiv-27622187bold, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 li.ygrps-yiv-331318111ygrps-yiv-27622187bold, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 div.ygrps-yiv-331318111ygrps-yiv-27622187bold
{

margin-right:0in;margin-left:0in;font-size:10.0pt;font-family:“Arial”, “sans-serif”;font-weight:bold;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 p.ygrps-yiv-331318111ygrps-yiv-27622187green, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 li.ygrps-yiv-331318111ygrps-yiv-27622187green, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 div.ygrps-yiv-331318111ygrps-yiv-27622187green
{

margin-right:0in;margin-left:0in;font-size:12.0pt;font-family:“Times New Roman”, “serif”;color:#628C2A;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 p.ygrps-yiv-331318111ygrps-yiv-27622187replbq, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 li.ygrps-yiv-331318111ygrps-yiv-27622187replbq, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 div.ygrps-yiv-331318111ygrps-yiv-27622187replbq
{
margin:3.0pt;font-size:12.0pt;font-family:“Times New Roman”, “serif”;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 p.ygrps-yiv-331318111ygrps-yiv-27622187ad, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 li.ygrps-yiv-331318111ygrps-yiv-27622187ad, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 div.ygrps-yiv-331318111ygrps-yiv-27622187ad
{

margin-right:0in;margin-left:0in;font-size:12.0pt;font-family:“Times New Roman”, “serif”;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 p.ygrps-yiv-331318111ygrps-yiv-27622187underline, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 li.ygrps-yiv-331318111ygrps-yiv-27622187underline, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 div.ygrps-yiv-331318111ygrps-yiv-27622187underline
{

margin-right:0in;margin-left:0in;font-size:12.0pt;font-family:“Times New Roman”, “serif”;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 span.ygrps-yiv-331318111ygrps-yiv-27622187yshortcuts
{}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 p.ygrps-yiv-331318111ygrps-yiv-27622187ad1, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 li.ygrps-yiv-331318111ygrps-yiv-27622187ad1, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 div.ygrps-yiv-331318111ygrps-yiv-27622187ad1
{

margin-right:0in;margin-left:0in;font-size:12.0pt;font-family:“Times New Roman”, “serif”;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 p.ygrps-yiv-331318111ygrps-yiv-27622187ad2, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 li.ygrps-yiv-331318111ygrps-yiv-27622187ad2, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 div.ygrps-yiv-331318111ygrps-yiv-27622187ad2
{

margin-right:0in;margin-bottom:7.5pt;margin-left:0in;font-size:12.0pt;font-family:“Times New Roman”, “serif”;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 p.ygrps-yiv-331318111ygrps-yiv-27622187underline1, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 li.ygrps-yiv-331318111ygrps-yiv-27622187underline1, #ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 div.ygrps-yiv-331318111ygrps-yiv-27622187underline1
{

margin-right:0in;margin-left:0in;font-size:12.0pt;font-family:“Times New Roman”, “serif”;text-decoration:underline;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 span.ygrps-yiv-331318111ygrps-yiv-27622187yshortcuts1
{
font-family:“Verdana”, “sans-serif”;font-weight:bold;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 span.ygrps-yiv-331318111ygrps-yiv-27622187yshortcuts2
{
font-family:“Verdana”, “sans-serif”;font-weight:normal;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 span.ygrps-yiv-331318111ygrps-yiv-27622187EmailStyle36
{
font-family:“Calibri”, “sans-serif”;color:#1F497D;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 .ygrps-yiv-331318111ygrps-yiv-27622187MsoChpDefault
{
font-size:10.0pt;}
#ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {
margin:1.0in 1.0in 1.0in 1.0in;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 div.ygrps-yiv-331318111ygrps-yiv-27622187WordSection1
{}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187
filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {
}
#ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {

font-family:Symbol;}
#ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {

font-family:“Courier New”;}
#ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {

font-family:Wingdings;}
#ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {

font-family:Wingdings;}
#ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {

font-family:Wingdings;}
#ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {

font-family:Wingdings;}
#ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {

font-family:Wingdings;}
#ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {

font-family:Wingdings;}
#ygrps-yiv-331318111 filtered #ygrps-yiv-331318111ygrps-yiv-27622187 {

font-family:Wingdings;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 ol
{margin-bottom:0in;}
#ygrps-yiv-331318111 #ygrps-yiv-331318111ygrps-yiv-27622187 ul
{margin-bottom:0in;}

What BO are you putting this on?  Do you really need code.  Seems like you might be able to do this with a few conditions and then a set action.  But if you
want to do it in code, I would suggest not going from the release to the detail to the release to the detail.  Because there could be many OrderRel to an OrderDtl, I would check the condition on the OrderDtl first and then go onto the OrderRel.  Also make
sure to RELEASE the table you lock.

 

Example:

 

FIND FIRST Resource
WHERE (Resource.Company =
CUR-COMP) AND
(Resource.ResourceID = ttCallContextBpmData.ShortChar01)
exclusive-lock.

 

      IF
AVAILABLE Resource THEN DO:

 

         Assign
Resource.Inactive =
TRUE.

 

      END.  
RELEASE RESOURCE.

 

 

Brenda

 

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]


Sent: Monday, February 01, 2016 1:20 PM

To: vantage@yahoogroups.com

Subject: [Vantage] Data Directive BPM - Need some ABL code help

 

 

Hey Everyone,

 

I am working on getting a BPM going which will automatically assign the sales rep to an order release if the applicable product is on the order. I am using a OrderRel.Character01 to hold this information as this is separate from the salesperson assigned
to an order. 

 

If any order line has a part number starting with "GDS" I want to assign the rep to all lines with part numbers starting with "GDS" or having a product group begin with "ECBL" or "PCBL". The following code seems to drill down to the correct level
but it fails to assign the value to character01 in all situations and in the case where the part number begins with "GDS", EPICOR fails to create the line when done from the create sales order wizard in quote entry. 

 

I have this code placed in a Standard Data Directive on the OrderRel Table.

 

Any ideas on what I am doing wrong??

 

 

For Each ttOrderRel:

Find First OrderDtl where OrderDtl.OrderNum = ttOrderRel.OrderNum and OrderDtl.PartNum BEGINS "GDS" No-Lock No-Error.

If Avail OrderDtl or ttOrderRel.PartNum BEGINS "GDS" then DO:

For Each OrderRel where OrderRel.OrderNum = ttOrderRel.OrderNum Exclusive-Lock:

Find First OrderDtl where OrderDtl.OrderNum = OrderRel.OrderNum and OrderDtl.OrderLine = OrderRel.OrderLine No-Lock No-Error.

If Avail OrderDtl and (OrderRel.PartNum BEGINS "GDS" or OrderDtl.ProdCode = "PCBL" or OrderDtl.ProdCode = "ECBL") then DO:

Assign OrderRel.Character01 = "TST".

End. /DO/

End. /For Each OrderRel/

End. /DO/

End. /Each ttOrderRel/