BO Method

Dear Expert,

Could you please let me know, how to pass only required parameter values while creating a new row for RCVHead using the BO method?

public static void GetNewRcvHeadWithPONum()
        {  	
			var wcfBinding = NetTcp.UsernameWindowsChannel();
            var appServer = new Uri("net.tcp://ServerName/InstanceName/Erp/BO/Receipt.svc");
            using (var receiptClient = new Erp.Proxy.BO.ReceiptImpl(wcfBinding, appServer))
            {
                receiptClient.ClientCredentials.UserName.UserName = "manager";
                receiptClient.ClientCredentials.UserName.Password = "manager";                
                ReceiptDataSet objds = new ReceiptDataSet();
                ReceiptDataSet.RcvHeadRow objRow = objds.RcvHead.NewRcvHeadRow();
                objRow["Company"] = "EPIC04";
                objRow["VendorNum"]      = 3;
                objRow["PurPoint"]       = "";
                objRow["PONum"]          = 29;
                objRow["PackSlip"]       = "PO-29";
                objRow["ReceiptDate"]    = "2021-01-23";
                objRow["EntryPerson"]    = "manager";
                objRow["SaveForInvoicing"] = 1;
                objRow["Invoiced"]       = 0;
                objRow["ReceiptComment"] = "";
                objRow["ReceivePerson"]  = "manager";
                objRow["ShipViaCode"]    = "FR";
                objRow["Plant"]          = "MfgSys";
                objRow["LCReference"]    = "";
                objRow["LCComment"]      = "";
                objRow["LandedCost"]     = 0;
                objRow["LegalNumber"]    = "MfgSys";
                objRow["LCVariance"]     = 0;
                objRow["ICLinked"]       = 0;
                objRow["GlbCompany"]     = "";
                objRow["GlbVendorNum"]   = 0;
                objRow["GlbPurPoint"]    = "";
                objRow["GlbPackSlip"]    = "";
                objRow["ContainerID"]    = 0;
                objRow["Weight"]         = 0;
                objRow["LCDisburseMethod"] = "Value";
                objRow["AutoReceipt"]    = 0;
                objRow["AutoTranType"]   = "";
                objRow["POType"]         = "STD";
                objRow["AutoTranID"]     = 0;
                objRow["WeightUOM"]      = "";
                objRow["UpliftPercent"]  = 0;
                objRow["SpecDutyAmt"]    = 0;
                objRow["AppliedLCAmt"]   = 0;
                objRow["LCDutyAmt"]      = 0;
                objRow["LCIndCost"]      = 0;
                objRow["ApplyToLC"]     = 0;
                objRow["Received"]      = 1;
                objRow["ArrivedDate"]   = "2021-01-23";
                objRow["AppliedRcptLCAmt"]  = 0;
                objRow["LCUpliftIndCost"]   = 0;
                objRow["AppliedLCVariance"] = 0;
                objRow["TranDocTypeID"]     = "GOODREC";
                objRow["ImportNum"]     = "";
                objRow["ImportedFrom"]  = 0;
                objRow["ImportedFromDesc"]  = "UAE";
                objRow["GrossWeight"] = 0;
                objRow["GrossWeightUOM"] = "";
                objRow["ChangedBy"]      = "manager";
                objRow["ChangeDate"]     = "2021-01-23";
                objRow["TaxRegionCode"]  = "IVAT";
                objRow["TaxPoint"]       = "2021-01-23";
                objRow["TaxRateDate"]    = "2021-01-23";
                objRow["InPrice"]        = 0;
                objRow["HdrTaxNoUpdt"]   = 0;
                objRow["TaxRateGrpCode"] = "";
                objRow["TaxesCalculated"]   = 0;
                objRow["InAppliedLCAmt"]    = 0;
                objRow["InAppliedLCVariance"]   = 0;
                objRow["InAppliedRcptLCAmt"]    = 0;
                objRow["InLandedCost"]      = 0;
                objRow["InLCDutyAmt"]       = 0;
                objRow["InLCIndCost"]       = 0;
                objRow["InLCUpliftIndCost"] = 0;
                objRow["InLCVariance"]      = 0;
                objRow["InSpecDutyAmt"]     = 0;
                objRow["RowMod"]    = "A";
                objds.RcvHead.AddRcvHeadRow(objRow);
                receiptClient.Update(objds);
            }
		}

Thanks in advance.

Technically you can create a receipt head with only a Supplier and Packing Slip but it looks like you want to also include the PO number.
One strategy is to create a receipt in the Epicor client filling in the least amount of required information, while generating a client trace. Try to have values(like vendor num) ready to enter, if you avoid opening any search screens you’re trace will be cleaner. Then diff the relevant part of the trace to get the minimum number of required fields you need to populate in code. You can use any diff tool, but this tool was written specifically for this and makes it easy to diff the relevant part. That page has a tutorial, check it out.

I just ran a quick test, used the diff tool, and came up with these as the min required fields(if including the PO number):

A couple things:

  • Many of these values come from previous BO method call responses, this will be evident in the trace.

  • You may be able to omit some of these, you can test and see

A good test is to use the UpdateExt logic. An updateable BAQ will require the minimum set of data for a record, so you can use that to set the values.
However, the best process would be to mimic what the UI does. This ensures all the fields are being populated properly.

When I am trying to insert a new row in the Receipt Detail using below mentioned code system is throwing error “The PO Release must be received as Stock”

public static void GetNewRcvHead()
        {           
            var wcfBinding = NetTcp.UsernameWindowsChannel();
            var appServer = new Uri("net.tcp://ServerName/InstanceName/Erp/BO/Receipt.svc");
            using (var receiptClient = new Erp.Proxy.BO.ReceiptImpl(wcfBinding, appServer))
            {
                receiptClient.ClientCredentials.UserName.UserName = "manager";
                receiptClient.ClientCredentials.UserName.Password = "manager";
                ReceiptDataSet objds = new ReceiptDataSet();

		receiptClient.GetNewRcvDtl(objds, 11, "", "PO-32");
                objds.RcvDtl[0]["VendorNum"] = 11;
                objds.RcvDtl[0]["PackLine"] = 1;
                objds.RcvDtl[0]["PONum"]    = 32;
                objds.RcvDtl[0]["POLine"]   = 1;
                objds.RcvDtl[0]["PORelNum"] = 1;
                objds.RcvDtl[0]["ReceiptDate"]     = "2021-02-02";
                objds.RcvDtl[0]["PartNum"]         = "100CB100EG-2.9";
                objds.RcvDtl[0]["PartDescription"] = "100X100MM ELECTROGALVANIZED CABLE BASKET TRAY, 2.9 MTR LONG";
                objds.RcvDtl[0]["WarehouseCode"]   = "SHJSA";
                objds.RcvDtl[0]["BinNum"]          = "SHJSAACC";
                objds.RcvDtl[0]["IUM"]             = "LTH";                    
                objds.RcvDtl[0]["OurQty"]          = 1;
                objds.RcvDtl[0]["OurUnitCost"]     = 100;
                objds.RcvDtl[0]["VendorQty"]       = 1;
                objds.RcvDtl[0]["VendorUnitCost"]  = 100;
                objds.RcvDtl[0]["ReceivedComplete"] = 1;                    
                objds.RcvDtl[0]["DimConvFactor"] = 1;
                receiptClient.Update(objds);
	  }
    }

That may be an accurate, data specific, BO message.
What happens if you run through the exact same example data in the Epicor client?

I have updated the code now system is throwing error “Valid Our Qty is required” but we are already passing the value in OurQty column for your reference code is mentioned below

 receiptClient.GetNewRcvDtl(objds, 11, "", "PO-32");
                        objds.RcvDtl[0]["VendorNum"] = 11;
                        objds.RcvDtl[0]["PackLine"] = 1;
                        objds.RcvDtl[0]["PONum"] = 32;
                        objds.RcvDtl[0]["POLine"] = 1;
                        objds.RcvDtl[0]["PORelNum"] = 1;
                        objds.RcvDtl[0]["ReceiptDate"] = "2021-02-02";
                        objds.RcvDtl[0]["PartNum"] = "100CB100EG-2.9";
                        objds.RcvDtl[0]["PartDescription"] = "100X100MM ELECTROGALVANIZED CABLE BASKET TRAY, 2.9 MTR LONG";
                        
                        objds.RcvDtl[0]["IUM"] = "LTH";
                        objds.RcvDtl[0]["PUM"] = "LTH";
                        objds.RcvDtl[0]["OurQty"] = Convert.ToDecimal(1);
                        objds.RcvDtl[0]["WarehouseCode"] = "SHJSA";
                        objds.RcvDtl[0]["BinNum"] = "SHJSAACC";
                        objds.RcvDtl[0]["LotNum"] = "OBJLOT-1";
                        objds.RcvDtl[0]["OurUnitCost"] = 100;
                        //objds.RcvDtl[0]["DocUnitCost"] = 100;                        
                        //objds.RcvDtl[0]["VendorQty"] = 1;
                        //objds.RcvDtl[0]["SupplierUnInvcReceiptQty"] = 1;
                        //objds.RcvDtl[0]["OurUnInvcReceiptQty"] = 1;                    
                        objds.RcvDtl[0]["ReceivedComplete"] = 1;
                        objds.RcvDtl[0]["Received"] = 1;
                        objds.RcvDtl[0]["ReceivedTo"] = "PUR-STK";
                        objds.RcvDtl[0]["Plant"] = "MfgSys";
                        receiptClient.Update(objds);

You need to call the change change line and change rel methods

I believe a TranType is required too.

These two parameters required more to insert RcvDtl using BO Method.

objds.RcvDtl[0][“InputOurQty”] = Convert.ToDecimal(1);
objds.RcvDtl[0][“VendorQty”] = 1;