Skip to Content
author's profile photo Former Member
Former Member

oBP.Update doesn't work when AddressType is bo_BillTo

Hi all,

I'm clueless as to why my oBP.Update doesn't work when adr.AdressType is bo_BillTo while it works just fine on bo_ShipTo.

Here is the code:

Function save(Optional ByVal FromCreate As Boolean = False)
        Dim adrlines As Integer = oBP.Addresses.Count
        Dim adrline As Integer
        Dim adr As SAPbobsCOM.BPAddresses = oBP.Addresses
        Dim emp As SAPbobsCOM.ContactEmployees
        SBOapp.StatusBar.SetText("Geschäftspartner-Daten werden gespeichert.", 3, SAPbouiCOM.BoStatusBarMessageType.smt_Warning)

        With Form.Items
            For adrline = 1 To adrlines
                Dim checked As Boolean = True
                If (Not FromCreate) Then
                    checked = False
                    Try
                        checked = mtAdr.Columns.Item("COL0").Cells.Item(adrline).Specific.checked
                    Catch ex As Exception
                   
                    End Try
                End If

                If (checked) Then
                    adr.SetCurrentLine(adrline - 1)

                    adr.ZipCode = .Item("zipcode").Specific.Value
                    adr.City = .Item("city").Specific.Value
                    adr.Country = cbCountry.Selected.Value
                    adr.Street = .Item("street").Specific.Value
                    If (FromCreate) Then
                        adr.AddressName = .Item("name").Specific.Value
                    End If

                    Debug.WriteLine(adr.AddressType)
                    oBP.Update()

                End If
            Next
            . . .

At Debug.WriteLine(adr.AddressType), it clearly shows that everytime the value is bo_BillTo, it doesn't update the billing address.

Does anybody know the solution?

I'm using SBO 2005 SP01 PL39, DI API 2005

Thanks for any clues.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2008 at 12:43 PM

    Hi David,

    the oBP.Update returns 0 for both bo_BillTo and bo_ShipTo. However, it only updates the shipping address.

    It's weird, isn't it? Do you have any more suggestion?

    Add a comment
    10|10000 characters needed characters exceeded

    • Andre,

      you said you get no error for both. (sounds like you update them twice)

      you should update them at the same time.

      bo_BillTo and bo_ShipTo belong both to the BusinessPartners.Addresses Object.

      you should go trough the address and update the whole Address tree at the same time

      and than update it.

      regards

      David

  • Posted on Apr 28, 2008 at 03:25 PM

    Hi,

    i would look if there's a DIAPI error after updating when the update is unequal 0

    Debug.WriteLine(oCompany.GetLastErrorDescription())

    regards

    David

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2008 at 02:29 PM

    Yes, I update first the billing address, and then the shipping address. Because it may be a case that a billing address is different from shipping address. Furthermore, it doesn't work either when I want to update only billing address. But it works when I want to update only shipping address.

    Your last sentence:

    "you should go trough the address and update the whole Address tree at the same time and than update it."

    Can you give me a little explanation or algorithm how it can be done?

    Thanks.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.