Skip to Content

Cancelling sales order using DI API

Hi All,

I am developing a code where I have to cancel a sales order using DI API SDK. I have search the SDK but not get any suitable reference .Please provide some suggestion on how to do this.

Thanks and Regards

Utpal Maity

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Apr 03, 2013 at 11:23 AM

    Hi,

    1. retrieve the document document.getbykey(...)

    2. document.cancel(0

    3. ready.

    Dim RetVal As Long

    Dim ErrCode As Long

    Dim ErrMsg As String

    Dim vItem As SAPbobsCOM.Items

    Set vItem = vCmp.GetBusinessObject(oItems)

    'Retrieve the record to cancel from the databse

    RetVal = vItem.GetByKey("A00023")

    If RetVal <> 0 Then

    vCmp.GetLastError ErrCode, ErrMsg

    MsgBox "Failed to Retrieve the record " & ErrCode & " " & ErrMsg

    Exit Sub

    End If

    'Cancel the record

    RetVal = vItem.Cancel

    If RetVal <> 0 Then

    vCmp.GetLastError ErrCode, ErrMsg

    MsgBox "Failed to Cancel the record " & ErrCode & " " & ErrMsg

    End If

    Regards

    Ad

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 07, 2019 at 04:52 PM

    //Create a new Documents object
    Documents doc = comp.GetBusinessObject(BoObjectTypes.oDeliveryNotes);

    //Get a the document by key which will be cancelled
    doc.GetByKey(19);

    //Create an object which represent to a new cancellation document based on doc
    Documents cancelDoc = doc.CreateCancellationDocument();

    //We can modify some values in the cancellation document
    cancelDoc.DocDate = new DateTime(2012, 4, 8);

    //Then we can add this cancellation document, and at the same time the status of the base document will be changed into ‘canceled’

    cancelDoc.Add();

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.