Hi experts.
I developed an add-on that makes a "Issue For Production" using BatchNumber and BinLocation. In the test environment, was functioning normally in production is returning me the message: "Can not add row without complete selection of batch / serial numbers".
SAP 9/10 PL.
Has anyone experienced this or know of any settings that can influence?
my code:
doc = (Documents)Conexao.diCompany.GetBusinessObject(BoObjectTypes.oInventoryGenExit);
doc.BPL_IDAssignedToInvoice = GetFilial(lstLinhas[0].NumOP);
for (int i = 0; i < lstLinhas.Count; i++)
{
//Seta os valores das Linhas
doc.Lines.SetCurrentLine(i);
doc.Lines.BaseEntry = lstLinhas[i].NumOP;
doc.Lines.BaseType = 202;
doc.Lines.BaseLine = lstLinhas[i].NumLinhaOP;
//doc.Lines.ItemCode = linha.ItemCode;
//doc.Lines.Quantity = dQuantity;
//doc.Lines.WarehouseCode = linha.Deposito;
int iLinha = 0;
double dQuantity = 0;
double dQtdTotal = 0;
sDepositoPadrao = lstLinhas[i].Deposito;
for (int j = 0; j < lstItensLotes.Count; j++)
{
//Verifica se o item é de lote
GetConfigPadrao(sDepositoPadrao);
if (lstItensLotes[j].Item.Equals(lstLinhas[i].ItemCode))
{
if (iLinha.Equals(0))
{
//Variavel utilizada para controlar o valor setado na linhas
dQuantity = (from o in lstItensLotes
where o.Item.Equals(lstItensLotes[j].Item)
select o.Quantidade).Sum();
//Variavel para armazenar o valor total
dQtdTotal = dQuantity;
}
//Valores dos lotes
doc.Lines.BatchNumbers.SetCurrentLine(iLinha);
doc.Lines.BatchNumbers.BatchNumber = lstItensLotes[j].Lote;
if (dQuantity >= lstItensLotes[j].Quantidade)
{
doc.Lines.BatchNumbers.Quantity = lstItensLotes[j].Quantidade;
}
else doc.Lines.BatchNumbers.Quantity = dQuantity;
doc.Lines.BatchNumbers.Add();
//Valores de Bin
doc.Lines.BinAllocations.BinAbsEntry = iLocalPadrao;
if (dQuantity >= lstItensLotes[j].Quantidade)
{
doc.Lines.BinAllocations.Quantity = lstItensLotes[j].Quantidade;
dQuantity -= lstItensLotes[j].Quantidade;
}
else doc.Lines.BinAllocations.Quantity = dQuantity;
doc.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = iLinha;
doc.Lines.BinAllocations.SetCurrentLine(iLinha);
doc.Lines.BinAllocations.Add();
iLinha++;
}
}
doc.Lines.Quantity = dQtdTotal;
doc.Lines.Add();
}
//doc.SaveToFile("teste.xml");
Conexao.VerificaRetorno(doc.Add());