Customization Creating GRNI Invoices - Can't Create Detail 10.2.300.35

Hey there,

We have an implementation where the customer has 8 plants, with only one plant live so far.

All orders are going into Epicor, and then we’re issuing zero dollar drop ship POs to the other plants and they ship from there. We enter the drop shipments and invoice the customer, but we never match a vendor invoice to the PO. This generates lots and lots of received/not invoiced POs.

I have a customization going that will look for drop ships for specific vendors and create new GRNI invoice just fine. But having issues creating the receipt detail.

Here’s the code:

foreach (DataRow row in dtDropShipPO.Rows)
{
	int poNum = Convert.ToInt32(row["DropShipDtl_PONum"]);

	oTrans.GetNewManualGRNIClearing();
	edvAPInvHed.CurrentDataRow["REFPONum"] = row["DropShipDtl_PONum"];
	edvAPInvHed.CurrentDataRow["InvoiceDate"] = invoiceDate;
	//oTrans.ValidateGNRIClearingCreation();
	numRecs ++;

	// detail
MessageBox.Show("po " + poNum.ToString());
	getDropShipRecNotInvDtl(poNum);

	foreach (DataRow rowDtl in dtDropShipDtl.Rows)
	{
		**oTrans.GetNewAPInvDtl("REC"); // tried a type of R, REC, and RECEIVE**

MessageBox.Show("new row " + edvAPInvDtl.Row.ToString()); **// SHOWS ROW = -1**
		edvAPInvDtl.CurrentDataRow.BeginEdit();
		edvAPInvDtl.CurrentDataRow["DropShipPackSlip"] = Convert.ToInt32(rowDtl["DropShipDtl_PackSlip"]);
		edvAPInvDtl.CurrentDataRow["DropShipPackLine"] = Convert.ToInt32(rowDtl["DropShipDtl_PackLine"]);
		edvAPInvDtl.CurrentDataRow.EndEdit();
MessageBox.Show("after");
	}
}

MessageBox.Show(numRecs.ToString() + " Records created.");

I’m trying to create an entry in APinvDtl of type “receipt.” But after the line:

oTrans.GetNewAPInvDtl(“REC”); (I tried “R” which is what winds up in APInvDtl.LineType, and also “RECEIPT”)

No error at that point, but there isn’t a new record generated. At the message just following the row equals -1, and then I get an error trying to assign the pack list num.

Anyone done something like this?

I’ve thought about entering invoices via DMT, but don’t want them to have to do this every month until the project gets completed.

I also can generate a tool click with “New Receipt Line” but still have to go through manually selecting hundreds of drop ship detail lines.

Thanks,

Joe

I would go through the steps manually while collecting a client trace and compare the BO method calls and values in the trace to your code workflow. You could also see exactly what is passed in the parameter for GetNewAPInvDtl().

Adam,

As usual, the answers were in the trace.

I was trying to use oTrans methods to do the whole thing, but then the receipt selection is in a subform, so. . .

In the end, the trick in the BPM was that GetAPUninvoicedReceipts gets the selected receipt lines for the first receipt/pack. You have to read through the resulting table APUninvoicedRcptLines and use GetAPUninvoicedDropShipmentLines (for drop shipments, which is what I’m looking for) to get lines for subsequent receipts. Fun stuff!

Thanks for your help.

Joe