I am trying to create a partial goods receipt PO based on a purchase order. my code is below
I can do a full po receipt. But trying to do a partial gives me the following error.
- 4014 cannot add row without complete selection of batch/serial numbers.
I debugged the code and I am adding all serial numbers necessary - I think its something to do with setting the quantity but I cannot figure this out.
any help is much appreciated.
SAPbobsCOM.Documents documents = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes);
documents.CardCode = sPOVendorCode.Trim();
documents.HandWritten = SAPbobsCOM.BoYesNoEnum.tNO;
documents.DocDate = Convert.ToDateTime( oEd.String);
documents.DocDueDate = Convert.ToDateTime(oEd.String);
documents.Lines.SetCurrentLine(0); // there will be on,y one
documents.Lines.BaseEntry = Convert.ToInt32(lPODocEntry);
documents.Lines.BaseLine = 0;
documents.Lines.BaseType = 22;
documents.Lines.Quantity = Convert.ToInt32(dListQuantity);
documents.Lines.SerialNumbers.Quantity = Convert.ToInt32(dListQuantity);
documents.Lines.RequiredQuantity = Convert.ToInt32(dListQuantity);
Rs.DoQuery(sSql);
if (!(Rs.EoF && Rs.BoF))
{
int i = 0;
while (!(Rs.EoF))
{
documents.Lines.SerialNumbers.SetCurrentLine(i);
documents.Lines.SerialNumbers.InternalSerialNumber = sSerNo;
documents.Lines.SerialNumbers.Add();
Rs.MoveNext();
i++;
}
}
documents.Lines.Add();
int resp = documents.Add();