I have a need to delete a Sales Order Invoice using SData and I can't seem to figure it out. When I run an HTTPS DELETE request to https://<sdata-connector-server>/sdata/masapp/mascontract/<company-name>/SO_InvoiceHeaderSPECIAL('0026094')
I get the following response:
<?xml version="1.0" encoding="utf-8"?>
<sdata:diagnoses xmlns="schemas.sage.com/.../1" xmlns:xs="www.w3.org/.../XMLSchema" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sdata="schemas.sage.com/.../1" xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:opensearch="a9.com/.../" xmlns:sync="schemas.sage.com/.../1" xmlns:sme="schemas.sage.com/.../2007" xmlns:http="schemas.sage.com/.../1">
<sdata:diagnosis>
<sdata:severity>error</sdata:severity>
<sdata:sdataCode>ApplicationDiagnosis</sdata:sdataCode>
<sdata:applicationCode />
<sdata:message>This entry already exists in batch 02251.</sdata:message>
<sdata:stackTrace />
<sdata:payloadPath />
</sdata:diagnosis>
</sdata:diagnoses>
I tried sending the same HTTPS DELETE to SO_InvoiceHeader
(instead of SO_InvoiceHeaderSPECIAL
) and I get the same response. It sounds like if I was going to respond to the error I need to first remove the invoice from a batch and then I should be able to delete it. However, that proves problematic. I tried sending an HTTPS PUT query to https://<sdata-connector-server>/sdata/masapp/mascontract/<company-name>/
SO_InvoiceHeader('0026094')
with the following body to clear out the BatchNo field on the Invoice.
<entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xs="www.w3.org/.../XMLSchema" xmlns:cf="www.microsoft.com/.../2005" xmlns="http://www.w3.org/2005/Atom" xmlns:sdata="schemas.sage.com/.../1" xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:opensearch="a9.com/.../" xmlns:sync="schemas.sage.com/.../1" xmlns:sme="schemas.sage.com/.../2007" xmlns:http="schemas.sage.com/.../1">
<sdata:payload>
<SO_SalesOrderHeader sdata:uri="/sdata/masapp/mascontract/ts3/SO_InvoiceHeader('0026094')" xmlns="">
<BatchNo xsi:nil="true" />
</SO_SalesOrderHeader>
</sdata:payload>
</entry>
That leads to the same response as above ('This entry already exists in batch 02251.').
One other thing that has me wondering is that in Library Master > Role Maintenance the batch tables are only 'Read-Only' as I show here:
I wouldn't think that should affect my ability to delete an Invoice through SData because the Invoice tables aren't read-only. I would think that the batch table being read-only should only affect my ability to delete a batch...which is another topic and something I'd like to do too.
Is there something I'm missing or doing wrong with all this?