cancel
Showing results for 
Search instead for 
Did you mean: 

deleting warehouses from items

Former Member
0 Kudos

how can i delete the warehouse from a item by SDK, i'm using B1tch app to do that by python but some way i cannot find which is the method to iterate over the warehouse from that item and delete that warehouse that i don't want that item have, i'm using this

for almacen in browse(SAPbobsCOM.BoObjectTypes.oItems, query("select TOP 1 ItemCode from OITM ")):

          almacen.GetByKey(almacen.ItemCode);

          almacen.WhsInfo.WarehouseCode

but that just give me the first warehouse and anyway i can't delete it

Accepted Solutions (0)

Answers (1)

Answers (1)

simone_pastorin
Participant
0 Kudos

I would try with:

//retrieve item object as you want and then...

ItemWarehouseInfo iwi = oItem.WhsInfo;

//loop on warehouses

for this item for(i=0; i<iwi.Count; i++) {

    iwi.SetCurrentLine(i);

    if(iwi.WarehouseCode == "codeOfWarehouseIHate") {

        iwi.Delete();

        break;

    }

}

Tell us if it works!