2013年2月10日星期日

How to using x++ to modify sales line Qty

 Question
 Hi All, I tried to use X++ code to modified sales line qty, qty can be 
changed but how can I change others, like Delivery remainder and on order? 
the code I am using like below: 

SalesLine salesline; 

ttsbegin; 
select forupdate salesline where salesline.salesid=="xxxxx" && 
salesline.linenum ==1; 
salesline.SalesQty = 20; 
SalesLine::modifySalesQty(); 
salesLine.update(); 
ttscommit; 

after the code is run, on over view tab of sales line, I can see the qty is 
changed, but not effect to Deliver remainder which is in Quantity tab. how 
can I correct that? 

thank you.

--------------------------------------------------------------
Hello, 

try and add InventMovement::bufferSetRemainQty(salesLine); before you update 
the salesline. 

SalesLine::modifySalesQty(salesline, salesline.inventDim()); 
InventMovement::bufferSetRemainQty(salesLine); 
salesLine.update(); 


Regards 
--

1 条评论:

  1. com'on MS team, why so many logic in forms?
    So how many triggers should I pull to shoot with your gun
    Take a look in the classes around and see how many methods 'modifiedQty' or similar are available and figure out the what the mess...

    回复删除