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 GomezSoftware 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'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.Updatepre-processingCondition:the ttOrderDtl.SellingQuantity field has been changed from any to anyor the ttOrderDtl.PartNum field has been changed from any to anyor there is at least one added row in the ttOrderDtl tableAction:set the Number01 field of BPM Data to the ttOrderDtl.OrderNum expressionand enable dependent post process directivesPost processing:
Condition:
this directive has been enabled from the SetNetWeightOrder directiveAction:
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>