BPM Creates Sales Order And Fails To Update Header Order Amounts

Hi, hoping someone can point me in the right direction. Creating a sales order using a BPM and custom code. BPM successfully creates Header and detail row however header row OrderAmt/DocOrderAmt etc are not reflecting OrderDtl row DocExtPriceDtl values, header values remain 0.

These are the Methods i’m calling…

GetNewOrderHed
MasterUpdate
GetNewOrderDtl
ChangePartNumMaster
ChangeSellingQtyMaster
MasterUpdate

Any ideas what I’m missing?

You will need to buffer copy - then set the ready to calculate field in order for the totals to be updated in the OrderHead.

        // UPDATE THE ORDERS AS READY TO CALCULATE - Absolute magic with the buffer copy to realise that the ReadyToCalc need updating to true
        orderHedRow = ds.OrderHed.FirstOrDefault();
        var updatedRow = (Erp.Tablesets.OrderHedRow)ds.OrderHed.NewRow();  
        BufferCopy.Copy(orderHedRow, updatedRow);
        ds.OrderHed.Add(updatedRow);  
        updatedRow.ReadyToCalc = true;
        updatedRow.RowMod = "U";  
        
        // Call Update
        svc.MasterUpdate(true, true, "OrderHed", orderHedRow.CustNum, orderHedRow.OrderNum, false, out lContinue, out cResponseMsg, out cCreditShipAction, out cDisplayMsg, out cCompliantMsg, out cResponseMsgOrdRel, out cAgingMessage, ref ds);

Hi Alex, attempted buffer copy using below code and header values remain 0 here’s code snippet…

Erp.Tablesets.SalesOrderTableset ts = new Erp.Tablesets.SalesOrderTableset();

ts = soSvc.GetByID(intSalesOrderNum);

var orderHedRow = ts.OrderHed[0];

var updatedRow = ts.OrderHed.NewRow();

BufferCopy.Copy(orderHedRow, updatedRow); ts.OrderHed.Add(updatedRow);

updatedRow[“ReadyToCalc”] = true;
updatedRow.RowMod = “U”;

string outstring = string.Empty;

bool lContinue = true;
string cResponseMsg = string.Empty;
string cCreditShipAction = string.Empty;
string cDisplayMsg = string.Empty;
string cCompliantMsg = string.Empty;
string cResponseMsgOrdRel = string.Empty;
string cAgingMessage = string.Empty;

soSvc.MasterUpdate(true, true, “OrderHed”, orderHedRow.CustNum, orderHedRow.OrderNum, true, out lContinue, out cResponseMsg, out cCreditShipAction, out cDisplayMsg, out cCompliantMsg, out cResponseMsgOrdRel, out cAgingMessage, out outstring,out outstring,out outstring ,ref ts);