Skip to Content
Former Member
May 10, 2005 at 09:10 AM

Overwrite a certain existing address of an existing BusinessPartner


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


if (bFound) then

oBPAdrs.AdressName = "NewName"

oBPAdrs.Street = "NewStreet"



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.