on 05-10-2005 10:10 AM
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.
Hi
You need to tell sap the bussines parter you are using to view the address
oBP = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners)
<b>'code you need to add
obp.GetByKey("here you put the cardcode")
' end of addition</b>
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
and hope it works
regards
Salvador Biot
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Salvador
Thank You for reply.
Of course, it is necessary to get the certain BP before by the method oBP.GetByKey.
I did it too, but I didn't want to write it all, sorry for that.
But anyway, You do not doubt using of the method oBPAdrs.SetCurrentLine(iSelection). That quiets my mind.
Then it must be another run time error in my program.
Thanks again and best regards.
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.