Hi All,
I am trying to add sales order with sales order object.
I have completed connectivity from one database to another database.
but i am unable to post sales order with orders object.
My code is
ObjSales = objMain.objUtilities.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
ObjSales.DocDate = Date.Parse(System.DateTime.Now().ToString("d"))
ObjSales.DocDueDate = Date.Parse(System.DateTime.Now().ToString("d"))
ObjSales.TaxDate = Date.Parse(System.DateTime.Now().ToString("d"))
ObjSales.CardCode = "C0006"
ObjSales.Series = 92
ObjSales.PaymentGroupCode = 3
ObjSales.Comments = "vivek"
ObjSales.Lines.Add()
ObjSales.Lines.SetCurrentLine(1)
ObjSales.Lines.ItemCode = "5127"
ObjSales.Lines.Quantity = 100
ObjSales.Lines.UnitPrice = 10
ObjSales.Lines.WarehouseCode = "01"
ObjSales.Lines.TaxCode = "0"
ObjSales.Lines.DiscountPercent = "0.00"
ObjSales.DocTotal = 1000
If ObjSales.Add <> 0 Then
objMain.objApplication.SetStatusBarMessage("Sales or Not Posted", SAPbouiCOM.BoMessageTime.bmt_Short, True)
Exit Sub
else
objMain.objUtilities.ShowSuccessMessage("Sales Order Posted successfully")
End If
The above code is executing successfully.But the Sales order is not getting added.
Thanks in advance.
Hi Vivek,
If the code you posted is not throwing any errors, then the order really does get created. Apparently just not to both databases, am I correct ?
> I have completed connectivity from one database to another database.
That means that apparently you have not gotten this bit right.
Generally speaking if you want to create an order into two databases, you first need to connect to both databases and create separate order objects for each database. So you need to do this bit twice; once for each database. Something like this:
ObjSales1 = objMain.objUtilities1.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders) ObjSales2 = objMain.objUtilities2.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
Then at the end you also need to add both objects separately:
If ObjSales1.Add <> 0 Then etc. If ObjSales2.Add <> 0 Then etc
Good luck,
Johan
Add a comment