Showing results for 
Search instead for 
Did you mean: 

How to remove Draft Documents using DIAPI?

Former Member
0 Kudos

DIAPI help says that Remove Method is not supported because "SAP Business One does not allow to remove a document object from the database".

However, in SBO UI, you can remove Draft Documents. Is there another way or workaround in DI API for deleting Draft Documents?


Accepted Solutions (1)

Accepted Solutions (1)

Active Contributor

Juha, why do you think so?

The following snippet shows you how to kill Purchace-draft:

SAPbobsCOM.Documents oDraft;
oDraft = (SAPbobsCOM.Documents)pCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDrafts);

oDraft.DocObjectCode = SAPbobsCOM.BoObjectTypes.oPurchaseInvoices;
resCmpTo = oDraft.Remove();
if (resCmpTo != 0)
	pCmp.GetLastError(out errNum, out errStr);
	MessageBox.Show("oDraft.Remove(): " + errNum.ToString() + "n" + errStr);


Answers (0)