cancel
Showing results for 
Search instead for 
Did you mean: 

Delete BP Address

Former Member
0 Kudos

Hi all,

I try to delete an existing address in BP addresses. I used oBP.Addresses.AddressName.Remove(i)

but no success.

Any Idea?

Vangelis

Accepted Solutions (1)

Accepted Solutions (1)

former_member201110
Active Contributor
0 Kudos

Hi Vangelis,

Did you call the Update method of the BP after removing the address? It won't actually delete the address from the database until you update the main BP object.

Kind Regards,

Owen

Former Member
0 Kudos

Hi Owen,

I try something like:

oBP.GetByKey(strUser_Id)

For i As Integer = 0 To oBP.Addresses.Count - 1

oBP.Addresses.SetCurrentLine(i)

oBP.Addresses.AddressName.Remove(i)

Next

lretcode = oBP.Update

Thanks

former_member201110
Active Contributor
0 Kudos

Hi Vangelis,

I did a quick test and I think the issue is that you should be calling the Delete method of the Addresses object rather than the Remove method of the AddressName.

This works for me:


if(oBP.GetByKey(strUser_Id))
{
    for(int i = oBP.Addresses.Count - 1; i >= 0; i--)
    {
        oBP.Addresses.SetCurrentLine(i);
        oBP.Addresses.Delete();
    }
    if (oBP.Update() != 0)
    {
        _sboApp.SetStatusBarMessage("Error deleting addresses: " + _sboCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Medium, true);
    }
}

Kind Regards,

Owen

Edited by: Owen Slater on Aug 23, 2010 9:19 AM

Answers (0)