Adding a AP_InvoiceDetail line to an existing invoice using SData

I am using SData for Sage 100 to create invoices for AP.  I am able to create an AP_InvoiceHeader and a single AP_InvoiceDetail line item using the AP_InvoiceHeaderSPECIAL template including the standard AP_InvoiceDetail.  That works just fine.

The issue I am having is creating additional line items on the AP Invoice.  According to the Sage 100 ERP Guide to Sdata:

POST to simple resources to add a new child to an existing multitiered entity. For example, POST to SO_SalesOrderDetail to add a new line to an existing order.
Sage 100 ERP business objects will automatically make any necessary adjustments to the header (for order totals and such)

When I try to do this using AP_InvoiceDetail I get an error:  This entry already exists in batch 04990.   For reference, batch 04990 is the batch that contains my invoice I created using the AP_InvoiceHeaderSpecial.

Here is what my payload looks like.  For reference, my original Invoice is 399980, Division is 01, VendorNo is AIRWAY:

{<payload xmlns="schemas.sage.com/.../1">
<AP_InvoiceDetail p2:uri="developmentUrl/.../$template" xmlns:p2="schemas.sage.com/.../1" xmlns="">
<APDivisionNo>01</APDivisionNo>
<VendorNo>AIRWAY</VendorNo>
<InvoiceNo>399980</InvoiceNo>
<LineKey />
<LineSeqNo />
<AccountKey>100000000</AccountKey>
<JobNo />
<CostCode />
<CostType />
<UnitOfMeasure />
<CommentText />
<TransferAPDivisionNo />
<TransferVendorNo />
<TransferInvoiceNo />
<TransferForm1099 />
<TransferBox1099 />
<AssetTemplate />
<QuantityDistributed>0.0000</QuantityDistributed>
<DistributionAmt>3.00</DistributionAmt>
<RetentionRate>0.0000</RetentionRate>
<UnitCost>0.0000</UnitCost>
<RetentionAmt>0.0000</RetentionAmt>
<TransferDiscount>0.0000</TransferDiscount>
<DistributionPercentage>0.0000</DistributionPercentage>
</AP_InvoiceDetail>
</payload>}

  • 0
    Does anyone have a working example or even sample payload of adding a new AP_InvoiceDetail to an existing AP_Invoice? Thats all I am looking for here ....

    I have tried the above with multiple inputs (leaving the linekey off, adding a linekey, adding a lineSeqNo, leaving the lineSeqNo blank) - always I get the response that the entry already exists on my batch.