Hi Raj, Yes its fairly simple just copy this code into Axapta and focus on the comments which i wrote. static void createSalesOrder(Args _args) { AxSalesTable axSalesTable; AxSalesLine axSalesLine; NumberSequenceReference numberSequenceReference; NumberSeq numSeq; SalesTable salesTable; SalesId salesId; SalesFormLetter_invoice salesFormLetter; ; //Comment these three lines. // numberSequenceReference = SalesParameters::numRefSalesId(); // numSeq = NumberSeq::newGetNum(numberSequenceReference); // salesId = numSeq.num(); axSalesTable = AxSalesTable::construct(); axSalesTable.parmCustAccount('4009'); // here just try to give your Invoice number instead of salesId as i gave in example
axSalesTable.parmSalesId('00113_036'); axSalesTable.salesTable().initValue(); axSalesTable.salesTable().initFromContactInfo(); axSalesTable.salesTable().initFromCustTable(); axSalesTable.salesTable().validateWrite(); axSalesTable.save(); // Similarly here salesTable = SalesTable::find('00113_036'); axSalesLine = AxSalesLine::construct(); // Similarly here as well axSalesLine.parmSalesId('00113_036'); axSalesLine.salesLine().initFromSalesTable(salesTable); axSalesLine.salesLine().initValue(); axSalesLine.parmItemId("OL-1000"); axSalesLine.save(); salesFormLetter =new SalesFormLetter_invoice(TRUE); salesFormLetter.update(salesTable,SystemDateGet(),SalesUpdate::All,AccountOrder::None,false,true); } There you go.. All set.. Regards, Mohsin Zia. Rajkumar <[EMAIL PROTECTED]> wrote: Hi Mohsinzia, Really thanx for the help. Now what I need is, the invoice number getting created should be stopped as I want to put my own invoice number say which is stored in someother table. Numbersequence invoiceId should not be created. Any idea on that would be gr8. Regards, Raj --- In Axapta-Knowledge-Village@yahoogroups.com, Mohsin Zia <[EMAIL PROTECTED]> wrote: > > Hi Raj > > If you want to create a salesorder and then invoice it then here is the job you need. > > static void createSalesOrder(Args _args) > { > AxSalesTable axSalesTable; > AxSalesLine axSalesLine; > NumberSequenceReference numberSequenceReference; > NumberSeq numSeq; > SalesTable salesTable; > SalesId salesId; > SalesFormLetter_invoice salesFormLetter; > ; > numberSequenceReference = SalesParameters::numRefSalesId(); > numSeq = NumberSeq::newGetNum(numberSequenceReference); > salesId = numSeq.num(); > axSalesTable = AxSalesTable::construct(); > axSalesTable.parmCustAccount('4009'); > axSalesTable.parmSalesId(salesId); > axSalesTable.salesTable().initValue(); > axSalesTable.salesTable().initFromContactInfo(); > axSalesTable.salesTable().initFromCustTable(); > axSalesTable.salesTable().validateWrite(); > axSalesTable.save(); > salesTable = SalesTable::find(salesId); > axSalesLine = AxSalesLine::construct(); > axSalesLine.parmSalesId(salesId); > axSalesLine.salesLine().initFromSalesTable(salesTable); > axSalesLine.salesLine().initValue(); > axSalesLine.parmItemId("OL-1000"); > axSalesLine.save(); > salesFormLetter =new SalesFormLetter_invoice(TRUE); > salesFormLetter.update(salesTable, > SystemDateGet(),SalesUpdate::All,AccountOrder::None,false,true); > > } > > Regards, > Mohsin Zia > > > Rajkumar <[EMAIL PROTECTED]> wrote: > Hi All, > > Can anybody tell me how to Post a sales order and invoice using X++ > code. > > Regards, > Raj > > > > > > > --------------------------------- > Now that's room service! Choose from over 150,000 hotels > in 45,000 destinations on Yahoo! Travel to find your fit. > > [Non-text portions of this message have been removed] > --------------------------------- Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games. [Non-text portions of this message have been removed]