Using sap 9.1 add-on, stock transfer object to transfer items between two warehouses of the same branch. Here is my code: // Perform the Xfer SAPbobsCOM.StockTransfer sboTransfer; sboTransfer = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer); sboTransfer.DocDate = DateTime.Now; sboTransfer.TaxDate = DateTime.Now; sboTransfer.FromWarehouse = tmp_frmwhsCode; sboTransfer.Comments = "AddOn-Xfer"; sboTransfer.Lines.ItemCode = tmp_ItemCode; //sboTransfer.Lines.FromWarehouseCode = tmp_frmwhsCode; sboTransfer.Lines.WarehouseCode = tmp_whsCode;//to warehouse sboTransfer.Lines.Quantity = tmp_qty; sboTransfer.Add(); //Check Error oCompany.GetLastError(out nErr, out errMsg); if (0 != nErr) { Application.SBO_Application.MessageBox("Error Xferring Item to Warehouse: " + tmp_ItemCode + " (" + tmp_whsCode + "). Error Msg: " + oCompany.GetLastErrorDescription(), 1, "Ok", "", ""); Xfer_Bad_Summary += "\r\n Item: " + tmp_ItemCode; ErrorFound = true; } It failed because I guess there is a mismatch in branch. Currently the branch is 0. How do I set the branch when the object is instantiated? Thanks for all of your suggestions.
↧