Error in VisualStudio using services to create the SalesOrder

Hi,

I want to create the SalesOrder in Ax using visualStudio when i run the it show the following error.my code is attached below

SalesOrderSO.SO.SalesOrdersSOServiceClient obj = new SO.SalesOrdersSOServiceClient();
SalesOrderSO.SO.AxdSalesOrdersSO salesorder = new SO.AxdSalesOrdersSO();
SalesOrderSO.SO.AxdEntity_SalesTable salestable = new SO.AxdEntity_SalesTable();
salestable.CurrencyCode = “USD”;
salestable.CustAccount = “1101”;
salestable.Payment = “N001”;
salestable.PurchOrderFormNum = “PO”;
salestable.InvoiceAccount = “1101”;

salestable.LanguageId = “en-in”;
salestable.CustGroup=“20”;
salestable.DlvMode = “10”;

salestable.ShippingDateRequested = Convert.ToDateTime(“02/14/2017 12:00 AM”);

salestable.DeliveryDate = Convert.ToDateTime(“2/14/2017”);
SalesOrderSO.SO.AxdEntity_SalesLine salesline = new SO.AxdEntity_SalesLine();
salesline.ItemId = “1000”;
salesline.SalesQty = 5;
salesline.LinePercent = 1;

salesline.SalesUnit = “ea”;
salesline.CurrencyCode = “USD”;
salesline.CustAccount = “1101”;
salesline.PriceUnit = Convert.ToDecimal(2000.00);
// (Convert.ToDateTime(“12/5/2013 2:11:35 PM”), Convert.ToDateTime(“15-6-2013 2:11:35 PM”));
salesline.ShippingDateRequested = Convert.ToDateTime(“02/14/2017 12:00 AM”);
SalesOrderSO.SO.AxdEntity_InventDim inventdim = new SO.AxdEntity_InventDim();
/inventdim.configId = “HD”;
inventdim.InventColorId = “01”;
inventdim.InventSizeId = “42”;
/
inventdim.InventLocationId = “21”;
inventdim.InventSiteId = “2”;
salesline.InventDim = new SalesOrderSO.SO. AxdEntity_InventDim[1] { inventdim };
salestable.SalesLine = new SalesOrderSO.SO.AxdEntity_SalesLine[1] { salesline };
salesorder.SalesTable = new SalesOrderSO.SO.AxdEntity_SalesTable[1]
{
salestable
};
salesorder.SalesTable[0].SalesLine = salestable.SalesLine;
salesorder.SalesTable[0].SalesLine[0].InventDim = salesline.InventDim;

Look at the configuration of your inbound port and review mandatory fields - it sounds like you’ve set up SalesId to be mandatory. If not, maybe AX can’t assign the number for some reason, such as missing setup for the number sequence.

By the way, use Visual Studio to look at exception details, instead of just putting the message to the console. The exception object has quite a few other properties and some of them may be important.

In Exception it shows that … SalesOrder Field Must be filled in…and error in validating the data