## 4.2.15.2.4  Deleting Change Documents
Use class CL\_CHDO\_DELETE\_TOOLS to delete change documents.
First use GET\_INSTANCE method to create an instance for the interface IF\_CHDO\_DELETE\_TOOLS .
| Parameter Name   | Field Name   | Value Help                             |
|------------------|--------------|----------------------------------------|
| RO_INSTANCE      |              | Return parameter for instance creation |
Method IF\_CHDO\_DELETE\_TOOLS~CHANGEDOCUMENT\_DELETE deletes the change documents for one change document object. You can restrict the selection by various parameters (such as date, change number or time).
Import Parameters
| Parameter Name   | Field Name   | Value Help                                                                                                            |
|------------------|--------------|-----------------------------------------------------------------------------------------------------------------------|
| I_OBJECTCLASS    |              | Nameof change document object                                                                                         |
| I_OBJECTID       |              | Parameter of application objects IDs                                                                                  |
| I_UP_TO_DATE     |              | Date by which the change documents are to be deleted All change documents until the speci- fied date are deleted.     |
| I_CHANGENUMBER   |              | Change Number of Document If only one specific change document number is to be deleted, it can be trans- ferred here. |
| Parameter Name                | Field Name   | Value Help                                                                                                                                                                                                                                                                                                                                                                                      |
|-------------------------------|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| I_WITH_COMMIT                 |              | Flag whether there should be a COMMIT WORK in the method. The flag determines whether a COMMIT WORK should be called in the method. This can be necessary when a lot is to be deleted. In this case the delete operations are divided up to avoid Roll- back segment overflow. The division is by clusters, so that no inconsistencies occur in the case of cancellation.                       |
| COMMIT_COUNTER                |              | The parameter is only effective when a COMMIT WORK should be per- formed in the method (see parameter I_WITH_COMMIT ). In the method, as many object change documents are read as are passed in COMMIT_COUNTER . These change docu- ments are then deleted, and COMMIT WORK called. This procedure is repeated until there are no more change docu- ments for the object before the until date. |
| Export Parameter              |              |                                                                                                                                                                                                                                                                                                                                                                                                 |
| Parameter Name                | Field Name   | Value Help                                                                                                                                                                                                                                                                                                                                                                                      |
| E_NUMBER_OF_DELETED_HEADERS   |              | Number of deleted change document headers This parameter contains the number of deleted change document headers                                                                                                                                                                                                                                                                                 |
| E_NUMBER_OF_DELETED_POSITIONS |              | Number of deleted change document items This parameter contains the number of deleted change document items.                                                                                                                                                                                                                                                                                    |
| E_NUMBER_OF_DELETED_UIDS      |              | Number of deleted change document item GUIDs                                                                                                                                                                                                                                                                                                                                                    |
| E_NUMBER_OF_DELETED_STRINGS   |              | Number of deleted change document item STRINGs This parameter contains the number of deleted change document items with                                                                                                                                                                                                                                                                         |
##  Sample Code
```
DATA lv_objectclass   TYPE if_chdo_object_tools_rel=>ty_cdobjectcl VALUE 'ZTEST_CO'. DATA lv_objectid  TYPE cl_chdo_write_tools=>ty_cdobjectv VALUE '9990001'. DATA lv_changenr  TYPE cl_chdo_write_tools=>ty_cdchangenr VALUE '0000000001'. DATA lr_err TYPE REF TO cx_chdo_delete_error. ). TRY. DATA(lo_instance) = cl_chdo_delete_tools=>get_instance( ). lo_instance->if_chdo_delete_tools~changedocument_delete( EXPORTING i_objectclass                 = lv_objectclass it_objectid                   = lv_objectid i_changenumber                = lv_changenr i_with_commit                 = abap_true IMPORTING e_number_of_deleted_headers   = DATA(ls_headers) e_number_of_deleted_positions = DATA(ls_positions) e_number_of_deleted_uids      = DATA(ls_uids) e_number_of_deleted_strings   = DATA(ls_strings) ). CATCH cx_chdo_delete_error INTO lr_err. *    error handling for deletion ENDTRY.
```