Skip to Content

HOW I CAN CHANGE THE WHEREHOUSE IN SALES ORDER

Hi everyone somebody tell me how i can change the Warehouse Code with the SDK and Visual Studio .net i know how insert a saler order but i need change the Warehouse Code for some product lines i try do that with this code but dont work

 Dim oOrder As SAPbobsCOM.Documents
 oOrder = oCompany.GetBusinessObject(BoObjectTypes.oOrders)

oOrder.Lines.WhsCode = "07"
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Sep 28, 2017 at 04:05 PM

    Hi Luis,

    Your code is incomplete.

    A sample:

    //Initialize your object
    Documents oDoc = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);
    //the number of your sales order(DocEntry)
    int docEntry = 190;
    //Load your sales order
    if (oDoc.GetByKey(docEntry))
    {
        //Walk through your itens
        for (int i = 0; i < oDoc.Lines.Count; i++)
        {
            //Set the positon for the line
            oDoc.Lines.SetCurrentLine(i);
            //The new warehouse code
            oDoc.Lines.WarehouseCode = "09";
        }
        //Update your sales order in database
        if (oDoc.Update() != 0)
            MessageBox.Show(oCompany.GetLastErrorDescription());
    }
    

    Hope it helps.

    Kind Regards,

    Diego Lother

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 11, 2017 at 09:35 PM

    Perfect, thanks so much, where did you find the answer? do you have a manual?


    Add comment
    10|10000 characters needed characters exceeded