on 08-07-2017 5:11 PM - last edited on 02-04-2024 1:14 AM by postmig_api_4
Hi,
We try to create a draft stocktransfer with batches without success. We tried to create or update but the answer always is "DIAPI Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)"
We tried to add new draft, update existing draft without success.
Our code is:
protected override COMOperationResult OnExecute(Company company)
{
SAPbobsCOM.StockTransfer oStockTransferDraft = company.GetBusinessObject(BoObjectTypes.oStockTransferDraft);
oStockTransferDraft.DocObjectCode = BoObjectTypes.oStockTransfer;
string fromWarehouse = "KOZPONT";
string toWarehouse = "DOLGOZO";
int toBinlocation = 26;
string itemCode = "111462";
//string itemCode = "111058";
string batch = "64191K";
int quantity = 1;
string projectCode = "DESIGN";
try
{
oStockTransferDraft.FromWarehouse = fromWarehouse;
oStockTransferDraft.ToWarehouse = toWarehouse;
oStockTransferDraft.DocDate = DateTime.Now;
oStockTransferDraft.Lines.ItemCode = itemCode;
oStockTransferDraft.Lines.FromWarehouseCode = fromWarehouse;
oStockTransferDraft.Lines.WarehouseCode = toWarehouse;
oStockTransferDraft.Lines.Quantity = quantity;
oStockTransferDraft.Lines.ProjectCode = projectCode;
oStockTransferDraft.Lines.BatchNumbers.BaseLineNumber = 0;
oStockTransferDraft.Lines.BatchNumbers.Quantity = 0;
oStockTransferDraft.Lines.BatchNumbers.BatchNumber = batch;
//oStockTransferDraft.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batToWarehouse;
//oStockTransferDraft.Lines.BinAllocations.BinAbsEntry = toBinlocation;
//oStockTransferDraft.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;
//oStockTransferDraft.Lines.BinAllocations.Quantity = 1;
//oStockTransferDraft.Lines.BinAllocations.Add();
oStockTransferDraft.Lines.BatchNumbers.Add();
//oStockTransferDraft.Lines.BatchNumbers.BatchNumber = batch;
//oStockTransferDraft.Lines.BatchNumbers.Quantity = quantity;
oStockTransferDraft.Lines.Add();
int lRetCode = oStockTransferDraft.Add();
Console.WriteLine(lRetCode + " " + company.GetLastErrorDescription());
SAPbobsCOM.Documents created = company.GetBusinessObject(BoObjectTypes.oDrafts);
created.DocObjectCode = BoObjectTypes.oStockTransfer;
created.GetByKey(1405);
created.Lines.BaseType = 67;
created.Lines.BatchNumbers.BaseLineNumber = 0;
//created.Lines.BatchNumbers.Quantity = 1;
created.Comments = "asdd";
created.Lines.BatchNumbers.BatchNumber = batch;
created.Update();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return new COMOperationResult(null);
}
}
Hi Marton,
It appears that you are having the same scenario as mentioned in SAP Note 2442090. In order to resolve the issue, please check the same on SAP Business One Version 9.2 PL08 or higher.
Kind regards,
ANKIT CHAUHAN
SAP SME Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Or code now is:
It's work as final but not work with draft.
SAPbobsCOM.StockTransfer oStockTransferDraft = company.GetBusinessObject(BoObjectTypes.oStockTransferDraft);
oStockTransferDraft.DocObjectCode = BoObjectTypes.oStockTransfer;
string fromWarehouse = "KOZPONT";
string toWarehouse = "DOLGOZO";
int toBinlocation = 25;
string itemCode = "111462";
string batch = "456";
int quantity = 1;
string projectCode = "DESIGN";
try
{
oStockTransferDraft.FromWarehouse = fromWarehouse;
oStockTransferDraft.ToWarehouse = toWarehouse;
oStockTransferDraft.DocDate = DateTime.Now;
oStockTransferDraft.Lines.ItemCode = itemCode;
oStockTransferDraft.Lines.FromWarehouseCode = fromWarehouse;
oStockTransferDraft.Lines.WarehouseCode = toWarehouse;
oStockTransferDraft.Lines.Quantity = quantity;
oStockTransferDraft.Lines.ProjectCode = projectCode;
oStockTransferDraft.Lines.BatchNumbers.BatchNumber = batch;
oStockTransferDraft.Lines.BatchNumbers.Quantity = quantity;
oStockTransferDraft.Lines.BatchNumbers.Add();
oStockTransferDraft.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batToWarehouse;
oStockTransferDraft.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;
oStockTransferDraft.Lines.BinAllocations.BinAbsEntry = toBinlocation;
oStockTransferDraft.Lines.BinAllocations.Quantity = quantity;
oStockTransferDraft.Lines.BinAllocations.Add();
oStockTransferDraft.Lines.Add();
int lRetCode = oStockTransferDraft.Add();
Console.WriteLine(lRetCode + " " + company.GetLastErrorDescription());
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
The error is:
-5002 1470000465 You cannot allocate bin locations in document row 1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.