Skip to Content
author's profile photo
Former Member

How to Add Sales order from one database to another database

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Posted on May 02, 2011 at 09:39 AM

    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 comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on May 02, 2011 at 10:27 AM

    hi vivek.Y

    you can use B1isn solution for your issue . (SAP Business One Integration for SAP NetWeaver). you can download document in

    SAP channel parner portal or looking for Forum.

    thanks

    H2

    Add comment
    10|10000 characters needed characters exceeded