on 04-28-2008 11:28 AM
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.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
i would look if there's a DIAPI error after updating when the update is unequal 0
Debug.WriteLine(oCompany.GetLastErrorDescription())
regards
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
104 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.