Sunday, January 22, 2012

Sales Order using X++

Hi,
In this post we will learn the below using X++ :

 1) How to Create Sales Order
 2) How to Create Sales Order Line
 3) How to Post Sales Order


Code :
public static void SalesOrderDemo(Args _s)
{
// Create the Sales Order

SalesTable salesTable;
NumberSeq NumberSeq;
SalesId sid;
SalesLine sl;
SalesFormLetter fl;
;
NumberSeq =NumberSeq::newGetNumFromCode(SalesParameters::numRefSalesId().numberSequence);
sid=NumberSeq.num();
salesTable.SalesId = sid;
salesTable.initValue();
salesTable.CustAccount = "1101";
salesTable.initFromCustTable();
salesTable.insert();

//Create the Sales Line with the created Sales Order
sl.SalesId=sid;
sl.ItemId="1109";
sl.CreateLine(NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes);

info("Sales Order Created with Line");

//How to Post the Sales Order Invoice


fl=SalesFormLetter::construct(DocumentStatus::Invoice);
fl.update(SalesTable::find(sid));
info("Sales Order Posted");

}


Enjoy DAX!!!

2 comments:

  1. Hi,

    I need to copy existing sales order + lines to the new sales order and it's line in ax 2012 through x++ code.

    How we can do that? Any idea! Please share it.

    Regards,
    Zahir

    ReplyDelete
  2. A thorough course should cover many topics including: broker price opinions, how to locate these types of properties, how to finance the purchase, how to complete the short sale package, how to estimate the repairs for the property, and possibly how to liquidate the property by finding a buyer quickly. קורס מכירות

    ReplyDelete

Thanks for your time reviewing this blog.