Partial sales order through code in Dynamics ax 2012 R2

I updated the partial sales invoice through code...

 SalesFormLetter salesFormLetter =  SalesFormLetter::construct(DocumentStatus::Invoice);
 SalesTable salesTAble;
 SalesParmLine parmLine;
 ;
 salesTable = SalesTable::find('FUAE-000002');
 salesFormLetter.salesTable(salesTAble);
 salesFormLetter.transDate (systemDateGet());
 salesFormLetter.specQty (SalesUpdate::All);
 //If you want proforma you can enable the code
 //salesFormLetter.proforma (true);
 //salesFormLetter.printFormLetter (true);
 salesFormLetter.createParmUpdateFromParmUpdateRecord(salesFormLetter.s alesParmUpdate());
 salesFormLetter.initParmSalesTable(salesTAble);

 salesFormLetter.initParameters(salesFormLetter.salesParmUpdate(),Printout::After);
 salesFormLetter.initLinesQuery();
 while select forUpdate parmLine where parmLine.ParmId == salesFormLetter.parmId()
 {
 ttsBegin;
 parmLine.DeliverNow = 10;
 parmLine.setQty(parmLine.salesParmTable().ordering, salesFormLetter.SalesParmUpdate().creditRemaining);
 parmLine.setInventDeliverNow();
 parmLine.setLineAmount();
 parmLine.update();
 ttsCommit;
 }
 salesFormLetter.run();

Related Posts

Previous
Next Post »

Thanks for comments.....