cancel
Showing results for 
Search instead for 
Did you mean: 

Insert Delivery Address in Order record and DI API

Former Member
0 Kudos

Hi, I'm trying to insert the delivery address (Field: Address2) in the ORDR table of SBO2004 via the DI API (V6.7). I see the Address2 field in the members list, same as the Address field. (this works fine) But when I do the AddNew or Update method I get an error that the Public Member Address2 doesn't exist in the IDocuments. How can I achieve to insert a custom delivery address? ( Ofcourse I can insert via SQL insert direct on the table, I think..) But I would like to do it via the DI API like the other fields. And why was this field not before in the list and since the new DI API it is there, but doesn't work. Maybe only for reading... ?

2nd question: what is the best reference to set in my Code. The one to the DI API 2004 V6.7 or to the DI API Server V1.0 or to the SBO Bridge... V6.5?

For me it is not very clear about any differences. Where can I read which one to use?

Thanks in advance.

Arnold

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks Adele for your help! I figured it out. I re-installed the DI API versions and removed the interop.SAPBOBSCOM.dll from the bin directory and after a rebuild it worked!

Kind regards,

Arnold

Message was edited by: A. Westdijk

Former Member
0 Kudos

Hello Adele, thanks for help.

Unfortunately I still get the error message in Visual Studio 2005 (MissingMemberException): "Public member 'Address2' on type 'IDocuments' not found." It says also that the assembly doesn't refer to that member and that I have to recompile.

Maybe the DI API is not good registered? How can I check this? And how do I know if V6.5 or V6.7 is installed? Because in the SAPManage directory I see both installed.

I have a reference in my VS2005 to the DI API V6.7 because in DI API V6.5 the Address2 is not available in the fields listbox.

Hope you can still help me.

Thanks in advance!

My code is same:

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

Dim oOrder As SAPbobsCOM.Documents

oOrder = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)

oOrder.CardCode = "D062255"

oOrder.DocDate = Now

oOrder.DocDueDate = Now

oOrder.Address2 = "My Address"

oOrder.Lines.ItemCode = "10"

oOrder.Lines.Add()

oOrder.Lines.ItemCode = "20"

If oOrder.Add <> 0 Then

MessageBox.Show("Error: " & oCompany.GetLastErrorDescription)

Else

MessageBox.Show("Success")

End If

End Sub

Former Member
0 Kudos

Hi Arnold,

That exact same code works perfectly on my side. Only difference is that I am using visual studio version 2003 and not 2005. The problem seems to be some confusion with versions (seeing that it says the member cannot be found).

When you install the DI API you get the option to install the previous versions. I have the previous versions installed as well, but do not have the same problem as you do.

I assume that you running from your development environment, so the library you have referenced is the one that is used. You can make sure which one is attached by looking at the description on the properties of the referenced file (SAPbobsCOM).

Hope it helps,

Adele

Former Member
0 Kudos

Hi Arnold,

SBO Bridge... V6.5 refers to version 6.5 of SBO DI API.

DI API 2004 V6.7 refers to version 2004 of SBO DI API.

DI API 2004 V6.8 refers to version 2005 of SBO DI API.

DI API Server V1.0 refers to the DI Server and not the standard DI API. This is used for higher volume batch-like processing.

You should choose the one for the version you want to develop for.

Regarding your other problem, I have tried to add a sales order where I specify an address 2. This is the code and it works perfectly on my side:

            Dim oOrder As SAPbobsCOM.Documents
            oOrder = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
            oOrder.CardCode = "C1000"
            oOrder.DocDate = Now
            oOrder.DocDueDate = Now
            oOrder.Address2 = "My Address"
            oOrder.Lines.ItemCode = "A1000"
            oOrder.Lines.Add()
            oOrder.Lines.ItemCode = "A1001"
            If oOrder.Add <> 0 Then
                oApplication.MessageBox("Error: " & oCompany.GetLastErrorDescription)
            Else
                oApplication.MessageBox("Success")
            End If

Hope it helps,

Adele