## 4.2.15.2.2.3  Deleting a Change Document Object
Use method IF\_CHDO\_OBJECT\_TOOLS\_REL~DELETE\_OBJECT to delete change document objects. The name of the object is assigned using the import parameter IV\_OBJECT .
Furthermore, the import parameter IV\_DEL\_CL\_WHEN\_USED determines, if the class of the change document object should be deleted (if value passed is ABAP\_TRUE ) or not (value ABAP\_FALSE ) when it is still being used. The changes made to the class are saved in the transport request ( IV\_CORRNR ).
The export parameter ET\_ERRORS is used to return all deletion messages (messages from message class CD ).
The object will be deleted if no exception and no error messages of kind 'E-' were raised.
Import Parameters
Parameter Name
| IV_OBJECT   | Change document object name                       |
|-------------|---------------------------------------------------|
| IV_CORRNR   | Transport request where deletion should be logged |
Field Name
Value Help
| Parameter Name      | Field Name   | Value Help                                                                                   |
|---------------------|--------------|----------------------------------------------------------------------------------------------|
| IV_DEL_CL_WHEN_USED |              | Delete generated class "CL_<change document object name>_CHDO" even if it is currently used. |
| Export Parameters   |              |                                                                                              |
| Parameter Name      | Field Name   | Value Help                                                                                   |
| ET_ERRORS           |              |                                                                                              |
|                     | kind         | Message type (emtpy means informa- tion message, ,E-, means error)                           |
|                     | msgid        | Message class (CD)                                                                           |
|                     | msgnr        | Message ID                                                                                   |
|                     | v1           | Variable to message                                                                          |
|                     | v2           | Variable to message                                                                          |
|                     | v3           | Variable to message                                                                          |
|                     | v4           | Variable to message                                                                          |
|                     | text         | Short text of the message                                                                    |
##  Sample Code
```
CLASS zcl_chdo_delete_object DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_oo_adt_classrun. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_chdo_delete_object IMPLEMENTATION. METHOD if_oo_adt_classrun~main. data: ls_error              TYPE abap_bool, lr_err                TYPE REF TO cx_chdo_generation_error, lt_errors_err         TYPE LINE OF if_chdo_object_tools_rel=>ty_tr_error_tab, rt_errors             TYPE if_chdo_object_tools_rel=>ty_tr_error_tab. TRY. cl_chdo_object_tools_rel=>if_chdo_object_tools_rel~delete_object( EXPORTING iv_object           = 'ZCHDO_TEST'    " change document object name iv_corrnr           = '<transport_request>'   " transport request number iv_del_cl_when_used = 'X'             " delete class even when it is used IMPORTING et_errors           = rt_errors       " messages from deletion ). CATCH cx_chdo_generation_error into lr_err.
```
```
out->write( |Exception occurred: { lr_err->get_text( ) }| ). ls_error ='X'. ENDTRY. IF ls_error IS INITIAL. READ TABLE rt_errors WITH KEY kind = 'E-' INTO lt_errors_err. IF sy-subrc IS INITIAL. out->write( |Exception occurred: { lt_errors_err-text } | ). ELSE. out->write( |Change document object deleted | ). ENDIF. ENDIF. ENDMETHOD. ENDCLASS.
```