web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :

How to create sales order through code

Fawad Hassan Profile Picture Fawad Hassan 337

I found few good sample code for creating sales order in a book and I was able to compile a code for posting sales order invoice. I thought I should share on my blog. It might be useful for some one.

Code for creating Sales order

SalesTableType and SalesLinetype. Insert() should be called for creating the sales order. Example is as follows. I am currently looking for code that can contains example code of creating invoice from scratch. I will send you the code in an hour.

static void createSalesTable(CustAccount _custAccount)

{

SalesTable salesTable;

NumberSeq NumberSeq;

;

NumberSeq =

NumberSeq::newGetNumFromCode(SalesParameters::numRefSalesId

().numberSequence);

salesTable.SalesId = NumberSeq.num();

salesTable.initValue();

salesTable.CustAccount = _custAccount;

salesTable.initFromCustTable();

salesTable.insert();

}

Example: Create a Sales Line

static void createSalesLine(SalesId _salesId, ItemId _itemId)

{

SalesLine salesLine;

;

salesLine.clear();

salesLine.SalesId = _salesId;

salesLine.ItemId = _itemId;

salesLine.createLine(NoYes::Yes, // Validate

NoYes::Yes, // initFromSalesTable

NoYes::Yes, // initFromInventTable

NoYes::Yes, // calcInventQty

NoYes::Yes, // searchMarkup

NoYes::Yes); // searchPrice

}

Code for posting Sales order Invoice

static void createSalesOrder(Args _args)

{

SalesFormLetter formLetterObj;

formLetterObj = SalesFormLetter::construct(DocumentStatus::Invoice);

formLetterObj.update(SalesTable::find(“SO-101248″));

}



This was originally posted here.

Comments

*This post is locked for comments

  • Community Member Profile Picture Community Member
    Posted at

    HAPPY NEW YEAR GUYS Recently i got chace to work on sales order screen simplification where i need to

  • Community Member Profile Picture Community Member
    Posted at

    HAPPY NEW YEAR GUYS Recently i got chace to work on sales order screen simplification where i need to