Hello SBO programmers
How is to iterate through the address list of the business partner object?
My Use Case is:
I want to overwrite a specific entry of the address list and then update the BP.
Actually I try it with ...
oBP = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners)
oBPAdrs = oBP.Addresses
SearchForName = "OldName"
bFound = False
For iSelection = 0 to (m_oBP.Addresses.Count-1)
oBPAdrs.SetCurrentLine (iSelection)
if (SearchForName.Equals(m_oBP.Addresses.AdressName)) then
bFound = True
Exit For
end if
Next
if (bFound) then
oBPAdrs.AdressName = "NewName"
oBPAdrs.Street = "NewStreet"
...
oBP.Update()
end if
... but m_oBP.Addresses.SetCurrentLine() results in the hurtful exception
"This thread has been terminated".
It seems to be completly wrong using this method.
Is it an allowed way? Or do I have to go another way?
Best regards and thanks for help.