📚 SAP Business One SDK Help

CreateCancellationDocument Method
See Also  Example

Description

Creates a cancellation document when a marketing document is added in error, has become invalid, or has no concrete transactions associated with it.

Syntax

Visual Basic
Public Function CreateCancellationDocument() As Documents

Example

C#Copy Code
//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();    

See Also