Creating AP Invoice Line item for closed Purchase Order Line

I’m working on an integration project and I’m running into an error that stoping the creation of an AP Invoice Line Item. When I give the APInvDtl object a reference to the Purchase Order Line number and when the Purchase Order Line has been closed, I get the exception:

{“HttpStatus”:400,“ReasonPhrase”:“REST API Exception”,“ErrorMessage”:“The Purchase Order Line has been closed.”,“ErrorType”:“Ice.Common.BusinessObjectException”,“ErrorDetails”:[{“Message”:“The Purchase Order Line has been closed.”,“Type”:“Error”,“Table”:“APInvDtl”,“Program”:“Epicor.RESTApi.Common.dll”,“Method”:“ThrowUpdateExtException”,“ColumnNumber”:17,“LineNumber”:27}],“CorrelationId”:“0ee4ffc7-e389-4c66-b016-7dcf8f8ccf3c”}

My JSON for a line item encountering this issue is below

    "Company": "MyCompany",
    "VendorNum": 946,
    "InvoiceNum": "1132735",
    "InvoiceLine": 1,
    "LineType": "R",
    "UnitCost": null,
    "DocUnitCost": 10000,
    "PartNum": "Printer",
    "PONum": 70200043,
    "POLine": 1,
    "PORelNum": null,
    "Description": "Large Printer",
    "JobNum": null,
    "AssemblySeq": null,
    "JobSeqType": null,
    "JobSeq": null,
    "PurPoint": null,
    "PackSlip": null,
    "PackLine": null,
    "VendorQty": 1,
    "PUM": "EA",
    "OurQty": null,
    "IUM": "EA",
    "CostPerCode": null,
    "VenPartNum": null,
    "ExtCost": null,
    "DocExtCost": null,
    "TotalMiscChrg": null,
    "DocTotalMiscChrg": null,
    "LineComment": null,
    "MatchDate": null,
    "MatchFiscalYear": null,
    "MatchFiscalPeriod": null,
    "TaxExempt": null,
    "TaxCatID": null,
    "AdvancePayAmt": null,
    "DocAdvancePayAmt": null,
    "PurchCode": null,
    "LineDiscAmt": null,
    "DocLineDiscAmt": null,
    "GlbCompany": null,
    "GlbVendorNum": null,
    "GlbInvoiceNum": null,
    "GlbInvoiceLine": null,
    "AdvGainLoss": null,
    "MultiCompany": null,
    "RevChargeMethod": null,
    "OverrideReverseCharge": null,
    "RevChargeApplied": null,
    "Rpt1AdvancePayAmt": null,
    "Rpt2AdvancePayAmt": null,
    "Rpt3AdvancePayAmt": null,
    "Rpt1ExtCost": null,
    "Rpt2ExtCost": null,
    "Rpt3ExtCost": null,
    "Rpt1LineDiscAmt": null,
    "Rpt2LineDiscAmt": null,
    "Rpt3LineDiscAmt": null,
    "Rpt1TotalMiscChrg": null,
    "Rpt2TotalMiscChrg": null,
    "Rpt3TotalMiscChrg": null,
    "Rpt1UnitCost": null,
    "Rpt2UnitCost": null,
    "Rpt3UnitCost": null,
    "DocAdvPayAppld": null,
    "Rpt1AdvGainLoss": null,
    "Rpt2AdvGainLoss": null,
    "Rpt3AdvGainLoss": null,
    "MatchFiscalYearSuffix": null,
    "MatchFiscalCalendarID": null,
    "TaxRegionCode": null,
    "ContainerID": null,
    "DropShipPackLine": null,
    "DropShipPackSlip": null,
    "CorrectionDtl": null,
    "TaxConnectCalc": null,
    "AssetNum": null,
    "AdditionNum": null,
    "InvoiceLineRef": 1,
    "DocAssetInvoiceBal": null,
    "AssetBalOurQty": null,
    "AssetQtyIUM": null,
    "DMRNum": null,
    "DMRActionNum": null,
    "CreatedFromExpense": null,
    "InUnitCost": null,
    "DocInUnitCost": null,
    "Rpt1InUnitCost": null,
    "Rpt2InUnitCost": null,
    "Rpt3InUnitCost": null,
    "InExtCost": null,
    "DocInExtCost": null,
    "Rpt1InExtCost": null,
    "Rpt2InExtCost": null,
    "Rpt3InExtCost": null,
    "InTotalMiscChrg": null,
    "DocInTotalMiscChrg": null,
    "Rpt1InTotalMiscChrg": null,
    "Rpt2InTotalMiscChrg": null,
    "Rpt3InTotalMiscChrg": null,
    "InAdvancePayAmt": null,
    "DocInAdvancePayAmt": null,
    "Rpt1InAdvancePayAmt": null,
    "Rpt2InAdvancePayAmt": null,
    "Rpt3InAdvancePayAmt": null,
    "InLineDiscAmt": null,
    "DocInLineDiscAmt": null,
    "Rpt1InLineDiscAmt": null,
    "Rpt2InLineDiscAmt": null,
    "Rpt3InLineDiscAmt": null,
    "NoTaxRecal": null,
    "DevInt1": null,
    "DevInt2": null,
    "DevDec1": null,
    "DevDec2": null,
    "DevDec3": null,
    "DevDec4": null,
    "DevLog1": null,
    "DevLog2": null,
    "DevChar1": null,
    "DevChar2": null,
    "DevDate1": null,
    "DevDate2": null,
    "SysRevID": null,
    "SysRowID": null,
    "ScrWithholdAmt": null,
    "DocScrWithholdAmt": null,
    "Rpt1ScrWithholdAmt": null,
    "Rpt2ScrWithholdAmt": null,
    "Rpt3ScrWithholdAmt": null,
    "InvoiceRef": null,
    "APTranNo": null,
    "DocAdvPayAppliedAmt": null,
    "Code1099ID": null,
    "Gen1099Code": null,
    "FormTypeID": null,
    "DEIsServices": null,
    "DEIsSecurityFinancialDerivative": null,
    "DEInternationalSecuritiesID": null,
    "DEIsInvestment": null,
    "DEPayStatCode": null,
    "DeferredExp": null,
    "DEACode": null,
    "DEAAmt": null,
    "DEAStartDate": null,
    "DEAEndDate": null,
    "DEDenomination": null,
    "ExternalPONum": null,
    "ChangedBy": null,
    "ChangeDate": null,
    "MYImportNum": null,
    "FinalInvoice": null,
    "CommodityCode": null,
    "TotalTax": null,
    "DocTotalTax": null,
    "Rpt1TotalTax": null,
    "Rpt2TotalTax": null,
    "Rpt3TotalTax": null,
    "TotalSATax": null,
    "DocTotalSATax": null,
    "Rpt1TotalSATax": null,
    "Rpt2TotalSATax": null,
    "Rpt3TotalSATax": null,
    "TotalDedTax": null,
    "DocTotalDedTax": null,
    "Rpt1TotalDedTax": null,
    "Rpt2TotalDedTax": null,
    "Rpt3TotalDedTax": null,
    "PBInvNum": null,
    "CancellationDtl": null,
    "AttributeSetID": null,
    "AttributeSetDescription": null,
    "AttributeSetShortDescription": null,
    "AdjustmentValue": null,
    "AllocationAmount": null,
    "AllocationDesc": null,
    "AllocationID": null,
    "AllowGLDistAdd": null,
    "AllowGLDistAllocation": null,
    "AllowGLDistDelete": null,
    "AllowJobMiscAdd": null,
    "AllowJobMiscDelete": null,
    "AllowJobMiscUpdate": null,
    "BaseCurrencyID": null,
    "BaseCurrSymbol": null,
    "CurrencyCode": null,
    "CurrencyID": null,
    "CurrencySwitch": null,
    "CurrSymbol": null,
    "DEACodeDesc": null,
    "DEAScheduled": null,
    "DebitMemo": null,
    "Distributed": null,
    "DocAdjustmentValue": null,
    "DocAllocationAmount": null,
    "DocDistributed": null,
    "DocDspLineTotal": null,
    "DocExpense": null,
    "DocGLLineTotal": null,
    "DocInTaxAmt": null,
    "DocLineExpenses": null,
    "DocLineSubtotal": 10000,
    "DocLineTotal": 10000,
    "DocNonDeducTaxExpense": null,
    "DocOrgExtCost": null,
    "DocPEDetAmt": null,
    "DocRecognized": null,
    "DocRemaining": null,
    "DocScrInvoiceBal": null,
    "DocScrTotalDedTax": null,
    "DocScrTotalSATax": null,
    "DocScrTotalTax": null,
    "DocScrUnitCost": 10000,
    "DocTotDistribAmt": null,
    "DocUnrecognized": null,
    "DocVariance": null,
    "DropShipment": null,
    "DspAllocationAmount": null,
    "DspLineTotal": null,
    "EnableDiscountAmt": null,
    "EnableIntrastat": null,
    "EnableIntrastatDsp": null,
    "EnablePurchaseCode": null,
    "EnableRevCharge": null,
    "EnableScrWithholdAmt": null,
    "EnableShipmentID": null,
    "EnableSubCData": null,
    "EnableSupplierXRef": null,
    "Expense": null,
    "GLAccount": null,
    "GLLineTotal": null,
    "GridVenPartNum": null,
    "GroupID": null,
    "InPrice": null,
    "InTaxAmt": null,
    "IsAdvance": null,
    "JPTaxAdjustment": null,
    "LineExpenses": null,
    "LineSubtotal": null,
    "LineTotal": null,
    "LineTypeDescription": null,
    "NonDeducTaxExpense": null,
    "OrgExtCost": null,
    "PEDetAmt": null,
    "POCostPerCode": null,
    "PODocUnitCost": null,
    "POLineDesc": null,
    "POPartNum": null,
    "POPUM": null,
    "POReceivedQty": null,
    "PORelIUM": null,
    "PORelOurQty": null,
    "PORelQty": null,
    "Posted": null,
    "POUnitCost": null,
    "POVenPartNum": null,
    "POWarn": null,
    "Print1099": null,
    "RcptDestination": null,
    "RcptIUM": null,
    "RcptOurQty": null,
    "RcptPartDescription": null,
    "RcptPartNum": null,
    "RcptPUM": null,
    "RcptReceiptDate": null,
    "RcptVendorQty": null,
    "RcptVenPartNum": null,
    "RecalcGLAcct": null,
    "Recognized": null,
    "Remaining": null,
    "RevChargeMethodDesc": null,
    "Rpt1AdjustmentValue": null,
    "Rpt1AllocationAmount": null,
    "Rpt1Distributed": null,
    "Rpt1DspLineTotal": null,
    "Rpt1Expense": null,
    "Rpt1GLLineTotal": null,
    "Rpt1InTaxAmt": null,
    "Rpt1LineExpenses": null,
    "Rpt1LineSubTotal": null,
    "Rpt1LineTotal": null,
    "Rpt1NonDeducTaxExpense": null,
    "Rpt1OrgExtCost": null,
    "Rpt1PEDetAmt": null,
    "Rpt1POUnitCost": null,
    "Rpt1Recognized": null,
    "Rpt1Remaining": null,
    "Rpt1ScrExtCost": null,
    "Rpt1ScrInvoiceBal": null,
    "Rpt1ScrLineDiscAmt": null,
    "Rpt1ScrTotalDedTax": null,
    "Rpt1ScrTotalMiscChrg": null,
    "Rpt1ScrTotalSATax": null,
    "Rpt1ScrTotalTax": null,
    "Rpt1ScrUnitCost": null,
    "Rpt1TotDistribAmt": null,
    "Rpt1Unrecognized": null,
    "Rpt1Variance": null,
    "Rpt2AdjustmentValue": null,
    "Rpt2AllocationAmount": null,
    "Rpt2Distributed": null,
    "Rpt2DspLineTotal": null,
    "Rpt2Expense": null,
    "Rpt2GLLineTotal": null,
    "Rpt2InTaxAmt": null,
    "Rpt2LineExpenses": null,
    "Rpt2LineSubtotal": null,
    "Rpt2LineTotal": null,
    "Rpt2NonDeducTaxExpense": null,
    "Rpt2OrgExtCost": null,
    "Rpt2PEDetAmt": null,
    "Rpt2POUnitCost": null,
    "Rpt2Recognized": null,
    "Rpt2Remaining": null,
    "Rpt2ScrExtCost": null,
    "Rpt2ScrInvoiceBal": null,
    "Rpt2ScrLineDiscAmt": null,
    "Rpt2ScrTotalDedTax": null,
    "Rpt2ScrTotalMiscChrg": null,
    "Rpt2ScrTotalSATax": null,
    "Rpt2ScrTotalTax": null,
    "Rpt2ScrUnitCost": null,
    "Rpt2TotDistribAmt": null,
    "Rpt2Unrecognized": null,
    "Rpt2Variance": null,
    "Rpt3AdjustmentValue": null,
    "Rpt3AllocationAmount": null,
    "Rpt3Distributed": null,
    "Rpt3DspLineTotal": null,
    "Rpt3Expense": null,
    "Rpt3GLLineTotal": null,
    "Rpt3InTaxAmt": null,
    "Rpt3LineExpenses": null,
    "Rpt3LineSubtotal": null,
    "Rpt3LineTotal": null,
    "Rpt3NonDeducTaxExpense": null,
    "Rpt3OrgExtCost": null,
    "Rpt3PEDetAmt": null,
    "Rpt3POUnitCost": null,
    "Rpt3Recognized": null,
    "Rpt3Remaining": null,
    "Rpt3ScrExtCost": null,
    "Rpt3ScrInvoiceBal": null,
    "Rpt3ScrLineDiscAmt": null,
    "Rpt3ScrTotalDedTax": null,
    "Rpt3ScrTotalMiscChrg": null,
    "Rpt3ScrTotalSATax": null,
    "Rpt3ScrTotalTax": null,
    "Rpt3ScrUnitCost": null,
    "Rpt3TotDistribAmt": null,
    "Rpt3Unrecognized": null,
    "Rpt3Variance": null,
    "ScrDocExtCost": null,
    "ScrDocLineDiscAmt": null,
    "ScrDocTotalMiscChrg": null,
    "ScrExtCost": null,
    "ScrInvoiceBal": null,
    "ScrInvoiceRef": null,
    "ScrLineDiscAmt": null,
    "ScrLineType": null,
    "ScrOurQty": null,
    "ScrTotalDedTax": null,
    "ScrTotalMiscChrg": null,
    "ScrTotalSATax": null,
    "ScrTotalTax": null,
    "ScrUnitCost": null,
    "ScrVendorQty": 1,
    "TotDistribAmt": null,
    "Unrecognized": null,
    "UpdateExtCreateLineGL": null,
    "UsePurchaseCode": null,
    "Variance": null,
    "UpdateExtOverrideRcpts": null,
    "RelatedToRcvDtlSysRowID": null,
    "EnableAttributeSetBtn": null,
    "DEPayStatCodeDescr": null,
    "DEDenominationDescr": null,
    "BitFlag": null,
    "AssemblySeqDescription": null,
    "AssetNumAssetDescription": null,
    "Code1099Description": null,
    "CommodityCodeDescription": null,
    "ContainerIDContainerDescription": null,
    "FormTypeDescription": null,
    "GLPurchPurchDesc": null,
    "InvoiceNumDescription": null,
    "JobNumPartDescription": null,
    "PartNumTrackInventoryAttributes": null,
    "PartNumTrackSerialNum": null,
    "PartNumTrackLots": null,
    "PartNumPricePerCode": null,
    "PartNumIUM": null,
    "PartNumSellingFactor": null,
    "PartNumTrackDimension": null,
    "PartNumPartDescription": null,
    "PartNumSalesUM": null,
    "PartNumAttrClassID": null,
    "POLineLineDesc": null,
    "POLineVenPartNum": null,
    "POLinePartNum": null,
    "TaxCatIDDescription": null,
    "VendorNumName": null,
    "VendorNumAddress2": null,
    "VendorNumCountry": null,
    "VendorNumCity": null,
    "VendorNumDefaultFOB": null,
    "VendorNumCurrencyCode": null,
    "VendorNumState": null,
    "VendorNumTermsCode": null,
    "VendorNumVendorID": null,
    "VendorNumAddress3": null,
    "VendorNumZIP": null,
    "VendorNumAddress1": null,
    "VendorPPName": null,
    "VrPONumShipToConName": null,
    "VrPONumShipName": null,
    "RowMod": "A",
    "APInvDtlDEASches": [],
    "APInvExps": [],
    "APInvJobs": [],
    "APInvMscs": [],
    "APInvPBs": [],
    "APLnTaxes": [],
    "APInvDtlTGLCs": [],
    "APInvDtlAttches": []
  }

I’m using the OData methods in the REST API.

If I set the line item to 0, the line item is created successfully. However, our purchasing team has said that they always want the reference to the PONumber and POLine on an AP Invoice Line.

An additional issue is, if I create a line item of type ‘Asset’ and I set the POLine to 0, I get an error saying:

{“HttpStatus”:400,“ReasonPhrase”:“REST API Exception”,“ErrorMessage”:“PO/Line fields are required”,“ErrorType”:“Ice.Common.BusinessObjectException”,“ErrorDetails”:[{“Message”:“PO/Line fields are required”,“Type”:“Error”,“Table”:“APInvDtl”,“Program”:“Epicor.RESTApi.Common.dll”,“Method”:“ThrowUpdateExtException”,“ColumnNumber”:17,“LineNumber”:27}],“CorrelationId”:“419492f7-5e0b-4061-9d17-4f35f172d885”}

Does anyone have any insight or advice on how to get around this error?

We don’t have access to the data objects that the RPC methods use.

If you are doing a receipt line you should pass the packslip information/

Thanks for that, I wasn’t sure if I needed to or not. I think we’re realizing that it’s nothing ore than a workflow issue, the PO and lines and being closed before the invoice is created. Based on a conversation I had with the AP team and consultant, that shouldn’t be happening.