on 2024 Apr 11 10:11 AM
Hello experts,
I am getting the error: Message:System.Runtime.InteropServices.COMException (0xFFFFFFFF): Invalid row
when trying to add a goods receipt. I want to add 2 rows of the same item that are batched.
What am I doing wrong?
SAPbobsCOM.Documents goodsReceipt = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry);
goodsReceipt.DocDate = DateTime.Now;
string monthName = DateTime.Now.ToString("MMM", CultureInfo.InvariantCulture);
string year = DateTime.Now.ToString("yy");
goodsReceipt.Lines.BatchNumbers.SetCurrentLine(0);
goodsReceipt.Lines.BatchNumbers.BatchNumber = monthName + year + giDocNum.ToString().PadLeft(5, '0') + "1";
goodsReceipt.Lines.BatchNumbers.Quantity = (Convert.ToDouble(EditText3.Value) - Convert.ToDouble(EditText6.Value)) / 2;
goodsReceipt.Lines.BatchNumbers.Add();
goodsReceipt.Lines.SetCurrentLine(0);
goodsReceipt.Lines.ItemCode = ComboBox2.Value;
goodsReceipt.Lines.AccountCode = wipCredit;
goodsReceipt.Lines.Quantity = (Convert.ToDouble(EditText3.Value) - Convert.ToDouble(EditText6.Value)) / 2;
goodsReceipt.Lines.UnitPrice = convertedPrice;
goodsReceipt.Lines.WarehouseCode = ComboBox3.Value;
goodsReceipt.Lines.CostingCode = unit;
goodsReceipt.Lines.CostingCode2 = prcCode;
goodsReceipt.Lines.Add();
goodsReceipt.Lines.BatchNumbers.SetCurrentLine(1);
goodsReceipt.Lines.BatchNumbers.BatchNumber = monthName + year + giDocNum.ToString().PadLeft(5, '0') + "2";
goodsReceipt.Lines.BatchNumbers.Quantity = (Convert.ToDouble(EditText3.Value) - Convert.ToDouble(EditText6.Value)) / 2;
goodsReceipt.Lines.BatchNumbers.Add();
goodsReceipt.Lines.SetCurrentLine(1);
goodsReceipt.Lines.ItemCode = ComboBox2.Value;
goodsReceipt.Lines.AccountCode = wipCredit;
goodsReceipt.Lines.Quantity = (Convert.ToDouble(EditText3.Value) - Convert.ToDouble(EditText6.Value)) / 2;
goodsReceipt.Lines.UnitPrice = convertedPrice;
goodsReceipt.Lines.WarehouseCode = ComboBox3.Value;
goodsReceipt.Lines.CostingCode = unit;
goodsReceipt.Lines.CostingCode2 = prcCode;
goodsReceipt.Lines.Add();int lRetCode2 = goodsReceipt.Add();
if (lRetCode2 != 0)
{
Regards,
Request clarification before answering.
User | Count |
---|---|
102 | |
16 | |
9 | |
7 | |
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.