cancel
Showing results for 
Search instead for 
Did you mean: 

HOW I CAN CHANGE THE WHEREHOUSE IN SALES ORDER

0 Kudos

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"

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

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


former_member185682
Active Contributor
0 Kudos

Great,

Don't forget to click on accept button below my answer if your doubt was solved.

Kind Regards,

Diego Lother

former_member185682
Active Contributor
0 Kudos

Hi Luis,

You can install SAP Business One SDK, it is a part of SAP Business One package.

In SDK you are able to find helps and samples.

Hope it helps.

Kind Regards,

Diego Lother

former_member185682
Active Contributor
0 Kudos

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