Skip to Content
author's profile photo
Former Member

How to remove Draft Documents using DIAPI?

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?

Juha

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 03, 2005 at 05:32 AM

    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;
    oDraft.GetByKey(<DraftDocEntry>);
    resCmpTo = oDraft.Remove();
    if (resCmpTo != 0)
    {
    	pCmp.GetLastError(out errNum, out errStr);
    	MessageBox.Show("oDraft.Remove(): " + errNum.ToString() + "n" + errStr);
    }

    HTH

    Add comment
    10|10000 characters needed characters exceeded