Update fields immediately in SalesOrder.Update BPM

 Hi again,


I have tried doing it with a pre-processing, the problem is that i can't get the calculation right then because of some orderdtl rows/lines already saved and some of them not (ttorderdtl). Do you have any suggestions for me on how to calculate all rows and get it to sum up all rows?

Kind regards,
Lisa



---In vantage@yahoogroups.com, <don.n.doan@...> wrote:

I could be wrong but wouldn't you want this on the pre-proc side and write to the ttorderhed table instead of the actual table and allow it to refresh itself instead of post-proc and forcing a refresh? 



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

Hi again,


My code (tried both in SalesOrder.MasterUpdate and .Update).

The values are saved correctly, but not showing immediately. And when the BPM is "done", half of the information on the Sales Order header disappear and you need to push the refresh button to get the fields to reappear again before doing anything else. What more do I Need?



Pre processing:
Condition: 

 there is at least on field added to the ttOrderdtl table.

Action:
Enable post processing directive


Post processing:

Condition:

this directive has been enabled from the NetWeight directive

Action:

SM04 orginal i production



Post processing:


Def var netweight as decimal.

def var totnetweight as decimal.


netweight = 0.


find first OrderHed where OrderHed.Company = CUR-COMP and (OrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .

if available OrderHed then do:

for each OrderDtl where OrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = OrderHed.OrderNum.


if available OrderDtl then do:



netweight = (OrderDtl.number10 * orderdtl.OrderQty).

totnetweight = totnetweight + netweight.


end.

end.


OrderHed.Number10 = totnetweight.

 run GetByID(OrderHed.OrderNum,{&output_dataset_SalesOrderDataset}).

end.



Please, anybody any suggestions??



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

I have done this exact BPM you have to do it on a Post Processing BPM and then call the GetBYID Business Object so that you can get a fresh dataset and not get the row has been modified error.


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile


Quis custodiet ipsos custodes?


On Wed, Sep 11, 2013 at 8:08 AM, <lisa.saren@...> wrote:

 
<div>
  
  
  <p>Hi again,</p><p><br>I tried doing it with a data directive now instead, but then it&#39;s calculating the data twice. How can i stop this from happeining?</p><p style="font-style:normal;font-size:13px;background-color:transparent;font-family:arial, helvetica, clean, sans-serif;">


OrderHed IN Transaction



def var netweight as decimal.

def var totnetweight as decimal.


netweight = 0.


for each ttOrderHed where ttOrderHed.Company = CUR-COMP and (ttOrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .


for each OrderDtl where ttOrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = ttOrderHed.OrderNum.


if available OrderDtl then do:


netweight = (OrderDtl.number10 * orderdtl.OrderQty).

totnetweight = totnetweight + netweight.


end.

end.


ttOrderHed.Number10 = totnetweight.

/*run lib\UpdateTableBuffer.p(Input BUFFER ttOrderHed:Handle,'Number10', totnetweight). */ 



end.




Kind regards,

Lisa 



— In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:


Hi everybody.

I've created a BPM to automatically calculate total net weight for a all lines in a Sales Order. The problem is that I can't find a way to get the BPM to update all fields right away. I've tried so many different approaches but nothing seems to be working 100%.


The BPM I'm using right now gives the user the message "Row has been modified by another user" if they don't save the order + orderline right away before proceeding with anything else. This is probably because the BPM wants to update the Order in the DB, but it just a temp-table before saving it.


I've tried to use the UpdateTableBuffer to update it right away but then I get problems with the calcuation and other stuff.


This is the BPM:

SalesOrder.Update 
pre-processing

Condition:
the ttOrderDtl.SellingQuantity field has been changed from any to any
or the ttOrderDtl.PartNum field has been changed from any to any
or there is at least one added row in the ttOrderDtl table

Action:
set the Number01 field of BPM Data to the ttOrderDtl.OrderNum expression
and enable dependent post process directives

Post processing:

Condition:

this directive has been enabled from the SetNetWeightOrder directive

Action:
Execute ABL:

Def var netweight as decimal.
def var totnetweight as decimal.


netweight = 0.

for each OrderHed where OrderHed.Company = CUR-COMP and (OrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .

for each OrderDtl where OrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = OrderHed.OrderNum.

if available OrderDtl then do:

netweight = (OrderDtl.number10 * orderdtl.OrderQty).
totnetweight = totnetweight + netweight.
end.
end.

OrderHed.Number10 = totnetweight.
end



Any ideas??

Kind regards,
Lisa

</div>
 


<div style="color:#fff;min-height:0;"></div>

Hi everybody.

I've created a BPM to automatically calculate total net weight for a all lines in a Sales Order. The problem is that I can't find a way to get the BPM to update all fields right away. I've tried so many different approaches but nothing seems to be working 100%.

The BPM I'm using right now gives the user the message "Row has been modified by another user" if they don't save the order + orderline right away before proceeding with anything else. This is probably because the BPM wants to update the Order in the DB, but it just a temp-table before saving it.

I've tried to use the UpdateTableBuffer to update it right away but then I get problems with the calcuation and other stuff.

This is the BPM:

SalesOrder.Update 
pre-processing
Condition:
the ttOrderDtl.SellingQuantity field has been changed from any to any
or the ttOrderDtl.PartNum field has been changed from any to any
or there is at least one added row in the ttOrderDtl table

Action:
set the Number01 field of BPM Data to the ttOrderDtl.OrderNum expression
and enable dependent post process directives

Post processing:
Condition:
this directive has been enabled from the SetNetWeightOrder directive

Action:
Execute ABL:

Def var netweight as decimal.
def var totnetweight as decimal.

netweight = 0.

for each OrderHed where OrderHed.Company = CUR-COMP and (OrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .

for each OrderDtl where OrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = OrderHed.OrderNum.

if available OrderDtl then do:

netweight = (OrderDtl.number10 * orderdtl.OrderQty).
totnetweight = totnetweight + netweight.
end.
end.

OrderHed.Number10 = totnetweight.
end



Any ideas??

Kind regards,
Lisa

Hi again,


I tried doing it with a data directive now instead, but then it's calculating the data twice. How can i stop this from happeining?


OrderHed IN Transaction



def var netweight as decimal.

def var totnetweight as decimal.


netweight = 0.


for each ttOrderHed where ttOrderHed.Company = CUR-COMP and (ttOrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .


for each OrderDtl where ttOrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = ttOrderHed.OrderNum.


if available OrderDtl then do:


netweight = (OrderDtl.number10 * orderdtl.OrderQty).

totnetweight = totnetweight + netweight.


end.

end.


ttOrderHed.Number10 = totnetweight.

/*run lib\UpdateTableBuffer.p(Input BUFFER ttOrderHed:Handle,'Number10', totnetweight). */ 



end.




Kind regards,

Lisa 



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

Hi everybody.

I've created a BPM to automatically calculate total net weight for a all lines in a Sales Order. The problem is that I can't find a way to get the BPM to update all fields right away. I've tried so many different approaches but nothing seems to be working 100%.

The BPM I'm using right now gives the user the message "Row has been modified by another user" if they don't save the order + orderline right away before proceeding with anything else. This is probably because the BPM wants to update the Order in the DB, but it just a temp-table before saving it.

I've tried to use the UpdateTableBuffer to update it right away but then I get problems with the calcuation and other stuff.

This is the BPM:

SalesOrder.Update 
pre-processing
Condition:
the ttOrderDtl.SellingQuantity field has been changed from any to any
or the ttOrderDtl.PartNum field has been changed from any to any
or there is at least one added row in the ttOrderDtl table

Action:
set the Number01 field of BPM Data to the ttOrderDtl.OrderNum expression
and enable dependent post process directives

Post processing:
Condition:
this directive has been enabled from the SetNetWeightOrder directive

Action:
Execute ABL:

Def var netweight as decimal.
def var totnetweight as decimal.

netweight = 0.

for each OrderHed where OrderHed.Company = CUR-COMP and (OrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .

for each OrderDtl where OrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = OrderHed.OrderNum.

if available OrderDtl then do:

netweight = (OrderDtl.number10 * orderdtl.OrderQty).
totnetweight = totnetweight + netweight.
end.
end.

OrderHed.Number10 = totnetweight.
end



Any ideas??

Kind regards,
Lisa

I have done this exact BPM you have to do it on a Post Processing BPM and then call the GetBYID Business Object so that you can get a fresh dataset and not get the row has been modified error.


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile
E: jose@...
http://www.josecgomez.com

     Â


Quis custodiet ipsos custodes?


On Wed, Sep 11, 2013 at 8:08 AM, <lisa.saren@...> wrote:

Â
<div>
  
  
  <p></p><p>Hi again,</p><p><br>I tried doing it with a data directive now instead, but then it&#39;s calculating the data twice. How can i stop this from happeining?</p><p style="font-style:normal;font-size:13px;background-color:transparent;font-family:arial, helvetica, clean, sans-serif;">


OrderHed IN Transaction



def var netweight as decimal.

def var totnetweight as decimal.


netweight = 0.


for each ttOrderHed where ttOrderHed.Company = CUR-COMP and (ttOrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .


for each OrderDtl where ttOrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = ttOrderHed.OrderNum.


if available OrderDtl then do:


netweight = (OrderDtl.number10 * orderdtl.OrderQty).

totnetweight = totnetweight + netweight.


end.

end.


ttOrderHed.Number10 = totnetweight.

/*run lib\UpdateTableBuffer.p(Input BUFFER ttOrderHed:Handle,'Number10', totnetweight). */Â



end.




Kind regards,

LisaÂ



— In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:


Hi everybody.

I've created a BPM to automatically calculate total net weight for a all lines in a Sales Order. The problem is that I can't find a way to get the BPM to update all fields right away. I've tried so many different approaches but nothing seems to be working 100%.


The BPM I'm using right now gives the user the message "Row has been modified by another user" if they don't save the order + orderline right away before proceeding with anything else. This is probably because the BPM wants to update the Order in the DB, but it just a temp-table before saving it.


I've tried to use the UpdateTableBuffer to update it right away but then I get problems with the calcuation and other stuff.


This is the BPM:

SalesOrder.UpdateÂ
pre-processing

Condition:
the ttOrderDtl.SellingQuantity field has been changed from any to any
or the ttOrderDtl.PartNum field has been changed from any to any
or there is at least one added row in the ttOrderDtl table

Action:
set the Number01 field of BPM Data to the ttOrderDtl.OrderNum expression
and enable dependent post process directives

Post processing:

Condition:

this directive has been enabled from the SetNetWeightOrder directive

Action:
Execute ABL:

Def var netweight as decimal.
def var totnetweight as decimal.


netweight = 0.

for each OrderHed where OrderHed.Company = CUR-COMP and (OrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .

for each OrderDtl where OrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = OrderHed.OrderNum.

if available OrderDtl then do:

netweight = (OrderDtl.number10 * orderdtl.OrderQty).
totnetweight = totnetweight + netweight.
end.
end.

OrderHed.Number10 = totnetweight.
end



Any ideas??

Kind regards,
Lisa

</div>
 


<div style="color:#fff;min-height:0;"></div>

Hi Jose,

Thanks for you answer, but now I get a 4gl stop message instead.


Same code as original post:


Def var netweight as decimal.

def var totnetweight as decimal.

def var iOrdernum as integer.

def var hSalesOrder as Handle no-undo.

netweight = 0.


RUN bo/SalesOrder.p PERSISTENT SET hSalesOrder.


for each ttorderhed .

assign iOrdernum = ttorderhed.OrderNum.

end.


for each OrderHed where OrderHed.Company = CUR-COMP and (OrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .


for each OrderDtl where OrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = OrderHed.OrderNum.


if available OrderDtl then do:



netweight = (OrderDtl.number10 * orderdtl.OrderQty).

totnetweight = totnetweight + netweight.


end.

end.


OrderHed.Number10 = totnetweight.

/*run lib\UpdateTableBuffer.p(Input BUFFER OrderHed:Handle,'Number10', totnetweight). */

/*RUN Update IN hSalesOrder({&input-output_dataset_SalesOrderDataSet}). */


RUN GetByID IN hSalesOrder(INPUT iOrdernum, {&output_dataset_SalesOrderDataSet}).



end.





What am I doing wrong here?

Kind regards,
Lisa


 



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

I have done this exact BPM you have to do it on a Post Processing BPM and then call the GetBYID Business Object so that you can get a fresh dataset and not get the row has been modified error.


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile


Quis custodiet ipsos custodes?


On Wed, Sep 11, 2013 at 8:08 AM, <lisa.saren@...> wrote:

 
<div>
  
  
  <p>Hi again,</p><p><br>I tried doing it with a data directive now instead, but then it&#39;s calculating the data twice. How can i stop this from happeining?</p><p style="font-style:normal;font-size:13px;background-color:transparent;font-family:arial, helvetica, clean, sans-serif;">


OrderHed IN Transaction



def var netweight as decimal.

def var totnetweight as decimal.


netweight = 0.


for each ttOrderHed where ttOrderHed.Company = CUR-COMP and (ttOrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .


for each OrderDtl where ttOrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = ttOrderHed.OrderNum.


if available OrderDtl then do:


netweight = (OrderDtl.number10 * orderdtl.OrderQty).

totnetweight = totnetweight + netweight.


end.

end.


ttOrderHed.Number10 = totnetweight.

/*run lib\UpdateTableBuffer.p(Input BUFFER ttOrderHed:Handle,'Number10', totnetweight). */ 



end.




Kind regards,

Lisa 



— In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:


Hi everybody.

I've created a BPM to automatically calculate total net weight for a all lines in a Sales Order. The problem is that I can't find a way to get the BPM to update all fields right away. I've tried so many different approaches but nothing seems to be working 100%.


The BPM I'm using right now gives the user the message "Row has been modified by another user" if they don't save the order + orderline right away before proceeding with anything else. This is probably because the BPM wants to update the Order in the DB, but it just a temp-table before saving it.


I've tried to use the UpdateTableBuffer to update it right away but then I get problems with the calcuation and other stuff.


This is the BPM:

SalesOrder.Update 
pre-processing

Condition:
the ttOrderDtl.SellingQuantity field has been changed from any to any
or the ttOrderDtl.PartNum field has been changed from any to any
or there is at least one added row in the ttOrderDtl table

Action:
set the Number01 field of BPM Data to the ttOrderDtl.OrderNum expression
and enable dependent post process directives

Post processing:

Condition:

this directive has been enabled from the SetNetWeightOrder directive

Action:
Execute ABL:

Def var netweight as decimal.
def var totnetweight as decimal.


netweight = 0.

for each OrderHed where OrderHed.Company = CUR-COMP and (OrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .

for each OrderDtl where OrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = OrderHed.OrderNum.

if available OrderDtl then do:

netweight = (OrderDtl.number10 * orderdtl.OrderQty).
totnetweight = totnetweight + netweight.
end.
end.

OrderHed.Number10 = totnetweight.
end



Any ideas??

Kind regards,
Lisa

</div>
 


<div style="color:#fff;min-height:0;"></div>

 Jose - Are you then in the Post Processing forcing a Refresh?  Do you put the weight calculation code on the GetByID directive?  Can you show us your Post Processing BPM?

Thanks,



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

I have done this exact BPM you have to do it on a Post Processing BPM and then call the GetBYID Business Object so that you can get a fresh dataset and not get the row has been modified error.


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile


Quis custodiet ipsos custodes?


On Wed, Sep 11, 2013 at 8:08 AM, <lisa.saren@...> wrote:

 
<div>
  
  
  <p>Hi again,</p><p><br>I tried doing it with a data directive now instead, but then it&#39;s calculating the data twice. How can i stop this from happeining?</p><p style="font-style:normal;font-size:13px;background-color:transparent;font-family:arial, helvetica, clean, sans-serif;">


OrderHed IN Transaction



def var netweight as decimal.

def var totnetweight as decimal.


netweight = 0.


for each ttOrderHed where ttOrderHed.Company = CUR-COMP and (ttOrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .


for each OrderDtl where ttOrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = ttOrderHed.OrderNum.


if available OrderDtl then do:


netweight = (OrderDtl.number10 * orderdtl.OrderQty).

totnetweight = totnetweight + netweight.


end.

end.


ttOrderHed.Number10 = totnetweight.

/*run lib\UpdateTableBuffer.p(Input BUFFER ttOrderHed:Handle,'Number10', totnetweight). */ 



end.




Kind regards,

Lisa 



— In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:


Hi everybody.

I've created a BPM to automatically calculate total net weight for a all lines in a Sales Order. The problem is that I can't find a way to get the BPM to update all fields right away. I've tried so many different approaches but nothing seems to be working 100%.


The BPM I'm using right now gives the user the message "Row has been modified by another user" if they don't save the order + orderline right away before proceeding with anything else. This is probably because the BPM wants to update the Order in the DB, but it just a temp-table before saving it.


I've tried to use the UpdateTableBuffer to update it right away but then I get problems with the calcuation and other stuff.


This is the BPM:

SalesOrder.Update 
pre-processing

Condition:
the ttOrderDtl.SellingQuantity field has been changed from any to any
or the ttOrderDtl.PartNum field has been changed from any to any
or there is at least one added row in the ttOrderDtl table

Action:
set the Number01 field of BPM Data to the ttOrderDtl.OrderNum expression
and enable dependent post process directives

Post processing:

Condition:

this directive has been enabled from the SetNetWeightOrder directive

Action:
Execute ABL:

Def var netweight as decimal.
def var totnetweight as decimal.


netweight = 0.

for each OrderHed where OrderHed.Company = CUR-COMP and (OrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .

for each OrderDtl where OrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = OrderHed.OrderNum.

if available OrderDtl then do:

netweight = (OrderDtl.number10 * orderdtl.OrderQty).
totnetweight = totnetweight + netweight.
end.
end.

OrderHed.Number10 = totnetweight.
end



Any ideas??

Kind regards,
Lisa

</div>
 


<div style="color:#fff;min-height:0;"></div>

Yes would really like to see that code as well Jose, Can't get this to work.


Kind regards,

Lisa



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

 Jose - Are you then in the Post Processing forcing a Refresh?  Do you put the weight calculation code on the GetByID directive?  Can you show us your Post Processing BPM?

Thanks,



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

I have done this exact BPM you have to do it on a Post Processing BPM and then call the GetBYID Business Object so that you can get a fresh dataset and not get the row has been modified error.


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile


Quis custodiet ipsos custodes?


On Wed, Sep 11, 2013 at 8:08 AM, <lisa.saren@...> wrote:

 
<div>
  
  
  <p>Hi again,</p><p><br>I tried doing it with a data directive now instead, but then it&#39;s calculating the data twice. How can i stop this from happeining?</p><p style="font-style:normal;font-size:13px;background-color:transparent;font-family:arial, helvetica, clean, sans-serif;">


OrderHed IN Transaction



def var netweight as decimal.

def var totnetweight as decimal.


netweight = 0.


for each ttOrderHed where ttOrderHed.Company = CUR-COMP and (ttOrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .


for each OrderDtl where ttOrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = ttOrderHed.OrderNum.


if available OrderDtl then do:


netweight = (OrderDtl.number10 * orderdtl.OrderQty).

totnetweight = totnetweight + netweight.


end.

end.


ttOrderHed.Number10 = totnetweight.

/*run lib\UpdateTableBuffer.p(Input BUFFER ttOrderHed:Handle,'Number10', totnetweight). */ 



end.




Kind regards,

Lisa 



— In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:


Hi everybody.

I've created a BPM to automatically calculate total net weight for a all lines in a Sales Order. The problem is that I can't find a way to get the BPM to update all fields right away. I've tried so many different approaches but nothing seems to be working 100%.


The BPM I'm using right now gives the user the message "Row has been modified by another user" if they don't save the order + orderline right away before proceeding with anything else. This is probably because the BPM wants to update the Order in the DB, but it just a temp-table before saving it.


I've tried to use the UpdateTableBuffer to update it right away but then I get problems with the calcuation and other stuff.


This is the BPM:

SalesOrder.Update 
pre-processing

Condition:
the ttOrderDtl.SellingQuantity field has been changed from any to any
or the ttOrderDtl.PartNum field has been changed from any to any
or there is at least one added row in the ttOrderDtl table

Action:
set the Number01 field of BPM Data to the ttOrderDtl.OrderNum expression
and enable dependent post process directives

Post processing:

Condition:

this directive has been enabled from the SetNetWeightOrder directive

Action:
Execute ABL:

Def var netweight as decimal.
def var totnetweight as decimal.


netweight = 0.

for each OrderHed where OrderHed.Company = CUR-COMP and (OrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .

for each OrderDtl where OrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = OrderHed.OrderNum.

if available OrderDtl then do:

netweight = (OrderDtl.number10 * orderdtl.OrderQty).
totnetweight = totnetweight + netweight.
end.
end.

OrderHed.Number10 = totnetweight.
end



Any ideas??

Kind regards,
Lisa

</div>
 


<div style="color:#fff;min-height:0;"></div>

Hi again,


My code (tried both in SalesOrder.MasterUpdate and .Update).

The values are saved correctly, but not showing immediately. And when the BPM is "done", half of the information on the Sales Order header disappear and you need to push the refresh button to get the fields to reappear again before doing anything else. What more do I Need?



Pre processing:
Condition: 

 there is at least on field added to the ttOrderdtl table.

Action:
Enable post processing directive


Post processing:

Condition:

this directive has been enabled from the NetWeight directive

Action:

SM04 orginal i production



Post processing:


Def var netweight as decimal.

def var totnetweight as decimal.


netweight = 0.


find first OrderHed where OrderHed.Company = CUR-COMP and (OrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .

if available OrderHed then do:

for each OrderDtl where OrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = OrderHed.OrderNum.


if available OrderDtl then do:



netweight = (OrderDtl.number10 * orderdtl.OrderQty).

totnetweight = totnetweight + netweight.


end.

end.


OrderHed.Number10 = totnetweight.

 run GetByID(OrderHed.OrderNum,{&output_dataset_SalesOrderDataset}).

end.



Please, anybody any suggestions??



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

I have done this exact BPM you have to do it on a Post Processing BPM and then call the GetBYID Business Object so that you can get a fresh dataset and not get the row has been modified error.


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile


Quis custodiet ipsos custodes?


On Wed, Sep 11, 2013 at 8:08 AM, <lisa.saren@...> wrote:

 
<div>
  
  
  <p>Hi again,</p><p><br>I tried doing it with a data directive now instead, but then it&#39;s calculating the data twice. How can i stop this from happeining?</p><p style="font-style:normal;font-size:13px;background-color:transparent;font-family:arial, helvetica, clean, sans-serif;">


OrderHed IN Transaction



def var netweight as decimal.

def var totnetweight as decimal.


netweight = 0.


for each ttOrderHed where ttOrderHed.Company = CUR-COMP and (ttOrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .


for each OrderDtl where ttOrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = ttOrderHed.OrderNum.


if available OrderDtl then do:


netweight = (OrderDtl.number10 * orderdtl.OrderQty).

totnetweight = totnetweight + netweight.


end.

end.


ttOrderHed.Number10 = totnetweight.

/*run lib\UpdateTableBuffer.p(Input BUFFER ttOrderHed:Handle,'Number10', totnetweight). */ 



end.




Kind regards,

Lisa 



— In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:


Hi everybody.

I've created a BPM to automatically calculate total net weight for a all lines in a Sales Order. The problem is that I can't find a way to get the BPM to update all fields right away. I've tried so many different approaches but nothing seems to be working 100%.


The BPM I'm using right now gives the user the message "Row has been modified by another user" if they don't save the order + orderline right away before proceeding with anything else. This is probably because the BPM wants to update the Order in the DB, but it just a temp-table before saving it.


I've tried to use the UpdateTableBuffer to update it right away but then I get problems with the calcuation and other stuff.


This is the BPM:

SalesOrder.Update 
pre-processing

Condition:
the ttOrderDtl.SellingQuantity field has been changed from any to any
or the ttOrderDtl.PartNum field has been changed from any to any
or there is at least one added row in the ttOrderDtl table

Action:
set the Number01 field of BPM Data to the ttOrderDtl.OrderNum expression
and enable dependent post process directives

Post processing:

Condition:

this directive has been enabled from the SetNetWeightOrder directive

Action:
Execute ABL:

Def var netweight as decimal.
def var totnetweight as decimal.


netweight = 0.

for each OrderHed where OrderHed.Company = CUR-COMP and (OrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .

for each OrderDtl where OrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = OrderHed.OrderNum.

if available OrderDtl then do:

netweight = (OrderDtl.number10 * orderdtl.OrderQty).
totnetweight = totnetweight + netweight.
end.
end.

OrderHed.Number10 = totnetweight.
end



Any ideas??

Kind regards,
Lisa

</div>
 


<div style="color:#fff;min-height:0;"></div>

I could be wrong but wouldn't you want this on the pre-proc side and write to the ttorderhed table instead of the actual table and allow it to refresh itself instead of post-proc and forcing a refresh? 



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

Hi again,


My code (tried both in SalesOrder.MasterUpdate and .Update).

The values are saved correctly, but not showing immediately. And when the BPM is "done", half of the information on the Sales Order header disappear and you need to push the refresh button to get the fields to reappear again before doing anything else. What more do I Need?



Pre processing:
Condition: 

 there is at least on field added to the ttOrderdtl table.

Action:
Enable post processing directive


Post processing:

Condition:

this directive has been enabled from the NetWeight directive

Action:

SM04 orginal i production



Post processing:


Def var netweight as decimal.

def var totnetweight as decimal.


netweight = 0.


find first OrderHed where OrderHed.Company = CUR-COMP and (OrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .

if available OrderHed then do:

for each OrderDtl where OrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = OrderHed.OrderNum.


if available OrderDtl then do:



netweight = (OrderDtl.number10 * orderdtl.OrderQty).

totnetweight = totnetweight + netweight.


end.

end.


OrderHed.Number10 = totnetweight.

 run GetByID(OrderHed.OrderNum,{&output_dataset_SalesOrderDataset}).

end.



Please, anybody any suggestions??



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

I have done this exact BPM you have to do it on a Post Processing BPM and then call the GetBYID Business Object so that you can get a fresh dataset and not get the row has been modified error.


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile


Quis custodiet ipsos custodes?


On Wed, Sep 11, 2013 at 8:08 AM, <lisa.saren@...> wrote:

 
<div>
  
  
  <p>Hi again,</p><p><br>I tried doing it with a data directive now instead, but then it&#39;s calculating the data twice. How can i stop this from happeining?</p><p style="font-style:normal;font-size:13px;background-color:transparent;font-family:arial, helvetica, clean, sans-serif;">


OrderHed IN Transaction



def var netweight as decimal.

def var totnetweight as decimal.


netweight = 0.


for each ttOrderHed where ttOrderHed.Company = CUR-COMP and (ttOrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .


for each OrderDtl where ttOrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = ttOrderHed.OrderNum.


if available OrderDtl then do:


netweight = (OrderDtl.number10 * orderdtl.OrderQty).

totnetweight = totnetweight + netweight.


end.

end.


ttOrderHed.Number10 = totnetweight.

/*run lib\UpdateTableBuffer.p(Input BUFFER ttOrderHed:Handle,'Number10', totnetweight). */ 



end.




Kind regards,

Lisa 



— In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:


Hi everybody.

I've created a BPM to automatically calculate total net weight for a all lines in a Sales Order. The problem is that I can't find a way to get the BPM to update all fields right away. I've tried so many different approaches but nothing seems to be working 100%.


The BPM I'm using right now gives the user the message "Row has been modified by another user" if they don't save the order + orderline right away before proceeding with anything else. This is probably because the BPM wants to update the Order in the DB, but it just a temp-table before saving it.


I've tried to use the UpdateTableBuffer to update it right away but then I get problems with the calcuation and other stuff.


This is the BPM:

SalesOrder.Update 
pre-processing

Condition:
the ttOrderDtl.SellingQuantity field has been changed from any to any
or the ttOrderDtl.PartNum field has been changed from any to any
or there is at least one added row in the ttOrderDtl table

Action:
set the Number01 field of BPM Data to the ttOrderDtl.OrderNum expression
and enable dependent post process directives

Post processing:

Condition:

this directive has been enabled from the SetNetWeightOrder directive

Action:
Execute ABL:

Def var netweight as decimal.
def var totnetweight as decimal.


netweight = 0.

for each OrderHed where OrderHed.Company = CUR-COMP and (OrderHed.ordernum = ttCallContextBpmData.number01) exclusive-lock .

for each OrderDtl where OrderHed.Company = OrderDtl.Company and OrderDtl.OrderNum = OrderHed.OrderNum.

if available OrderDtl then do:

netweight = (OrderDtl.number10 * orderdtl.OrderQty).
totnetweight = totnetweight + netweight.
end.
end.

OrderHed.Number10 = totnetweight.
end



Any ideas??

Kind regards,
Lisa

</div>
 


<div style="color:#fff;min-height:0;"></div>