Tengo un Problema no puedo crear el lote me sale error -2028 mi codigo es este.
SAPbobsCOM.Documents oDoc = Program.oCompany.GetBusinessObject(BoObjectTypes.oReturns);
oDoc.CardCode = oRec.Fields.Item("ID_OCRD").Value.ToString();
oDoc.DocDate = oRec.Fields.Item("factual").Value;
oDoc.TaxDate = oRec.Fields.Item("factual").Value;
oDoc.DocDueDate = oRec.Fields.Item("factual").Value;
oDoc.FolioNumber = Convert.ToInt32(oRec.Fields.Item("DOCGUIA").Value);
oDoc.Indicator = "DV";
oDoc.NumAtCard = oRec.Fields.Item("DOCGUIA").Value;
oDoc.FolioPrefixString = "DV";
oDoc.SalesPersonCode = 196;
oDoc.Comments = "MIGRACIO"
oDoc.UserFields.Fields.Item("U_EXX_MOTIVTRA").Value = "05";
oDoc.UserFields.Fields.Item("U_EXX_TIPOOPER").Value = "24";
oDoc.UserFields.Fields.Item("U_ID_DEV_CAL").Value = Id.ToString();
oDoc.DocType = BoDocumentTypes.dDocument_Items;
oDoc.Lines.ItemCode = oRecDet.Fields.Item("ITEMCODE").Value.ToString();
oDoc.Lines.WarehouseCode = WareHouse;
oDoc.Lines.UserFields.Fields.Item("U_EXF_Caso").Value = "05"
oDoc.Lines.UserFields.Fields.Item("U_EXF_DetCaso").Value = "024"
if (oDoc.Lines.BatchNumbers.BatchNumber != string.Empty)
{
oDoc.Lines.BatchNumbers.Add();
}
oDoc.Lines.BatchNumbers.SetCurrentLine(0);
oDoc.Lines.BatchNumbers.BatchNumber = "UNICO";
oDoc.Lines.BatchNumbers.Quantity = oRecDet.Fields.Item("CANTIDAD").Value;
oDoc.Lines.BatchNumbers.Add();
oDoc.Lines.Add();
oRecDet.MoveNext();
}
}
lRetCode = oDoc.Add();
if (lRetCode != 0)
{
int temp_int = lErrCode;
string temp_string = sErrMsg;
Program.oCompany.GetLastError(out temp_int, out temp_string);
modelo.actualizaErrorSAPDevolucion(Id, temp_string);
}