## 4.2.15.2.2.2  Updating a Change Document Object
Use method IF\_CHDO\_OBJECT\_TOOLS\_REL~UPDATE\_OBJECT to modify and regenerate change document objects.
The name of the object is assigned using the import parameter IV\_OBJECT . The object details and generation information are passed using the internal tables IT\_CD\_OBJECT\_DEF (the object definition), IT\_CD\_OBJECT\_TEXT (the object texts) and IS\_CD\_OBJECT\_GEN (the generation information).
If the internal tables are not filled, the object definition is read directly from the database tables TCDOB and TADIR and the generation information is read directly from database table TCDRP . If only parameter IS\_CD\_OBJECT\_GEN is passed, the change document object will be newly generated without changing the change document object definition. Use this method when the structure of a table, that belongs to the change document object, was changed.
Once generated, a class (&lt;name space&gt;CL\_&lt;change document object name&gt;\_CHDO) with methods WRITE and IF\_CHDO\_ENHANCEMENTS~AUTHORITY\_CHECK are created. You can use IV\_CL\_OVERWRITE to specify
whether an existing class can be overwritten with the specified name or not. If a class already exists and can't be overwritten, no changes will be made. Changes made to the class are saved in the transport request ( IV\_CORRNR ).
Method AUTHORITY\_CHECK of interface 'IF\_CHDO\_ENHANCEMENTS' must be implemented later on in order to enable an authorization check for reading change documents.
The export parameter ET\_ERRORS is used to return all generation messages (messages from message class CD ) . Any syntax errors in the generated class are provided using ET\_SYNT\_ERROR (with long text if applicable ( ET\_SYNT\_ERROR\_LONG )).
Import Parameters
| Parameter Name   | Field Name   | Value Help                                                                                                                                                                                                                                                                                                                                     |
|------------------|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| IV_OBJECT        |              | Nameof change document object                                                                                                                                                                                                                                                                                                                  |
| IT_CD_OBJECT_DEF |              | Change document object definition                                                                                                                                                                                                                                                                                                              |
|                  | TABNAME      | Nameof the table as defined in the dic- tionary                                                                                                                                                                                                                                                                                                |
|                  | MULTCASE     | If more than one record for a particu- lar table is to be documented during a single CREATE/UPDATE/DELETE opera- tion, the value MULTICASE should be 'ABAP_TRUE' or 'X' (multiple case). If no value is provided a single record can be documented and passed in a work area (single case).                                                    |
|                  | DOCUDEL      | DOCUDEL = SPACE The deletion of a table entry will be documented in one change document item using the table key to identify the table entry deleted. The fieldFNAME will be filled with 'KEY' . DOCUDEL = 'X' Each change document relevant field value of the table entry will be docu- mented individually in its own change document item. |
| Parameter Name   | Field Name   | Value Help                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
|------------------|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|                  | DOCUINS      | DOCUINS = SPACE The insert of a table entry will be docu- mented in one change document item using the table key to identify the in- serted table entry. The field FNAMEwill be filled with 'KEY' . DOCUINS = 'X' Each change document relevant field value of the table entry will be docu- mented individually in its own change document item. The change indicator is 'J' instead of 'I' .                                                                   |
|                  | REFNAME      | If fields of table TABNAME reference unit or currency field values from an- other table, the name of that table has to be passed here to document its val- ues as well. Only one reference table can be used for table TABNAME . In single case, the referenced entry from table REFNAME is passed as two additional work areas (old, new). In mul- tiple case, the import tables (old, new) are enhanced to include the referenced structure of table REFNAME . |
|                  | DOCUD_IF     | If you want to document the value of a field even though it is initial when data is deleted, mark this field. If it is not marked, log entries will only be written if the field values are not initial when they are deleted. Be aware that a lot of additional change documents may be written, if you choose this option. Only mark this flag if it is required.                                                                                              |
| Parameter Name    | Field Name   | Value Help                                                                                                                                                                                                                                                                                                                                                             |
|-------------------|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|                   | DOCUI_IF     | If you want to document the value of a field even though it is initial when data is inserted, mark this field. If it is not marked, log entries will only be written if the field values are not initial when they are inserted. Be aware that a lot of additional change documents may be written, if you choose this option. Only mark this flag, if it is required. |
| IT_CD_OBJECT_TEXT |              | Object texts for change document ob- ject                                                                                                                                                                                                                                                                                                                              |
|                   | LANG_KEY     | Language key of the text                                                                                                                                                                                                                                                                                                                                               |
|                   | OBJECT_TEXT  | Descriptive short text for the change document object                                                                                                                                                                                                                                                                                                                  |
| IS_CD_OBJECT_GEN  |              | Change document object generation in- formation                                                                                                                                                                                                                                                                                                                        |
|                   | AUTHOR       | User who performs the generation                                                                                                                                                                                                                                                                                                                                       |
|                   | UPDNAME      | User who performs the change                                                                                                                                                                                                                                                                                                                                           |
|                   | CHANGE_DATE  | Date of change                                                                                                                                                                                                                                                                                                                                                         |
|                   | CHANGE_TIME  | Time of change                                                                                                                                                                                                                                                                                                                                                         |
|                   | TEXTCASE     | Special Text Handling flag Select this field to log long text changes. The old and new status of long texts is not logged. Only the fact that they have been changed is noted.                                                                                                                                                                                         |
|                   | DEVCLASS     | Change document object package                                                                                                                                                                                                                                                                                                                                         |
| IV_CL_OVERWRITE   |              | Whether generated class should over- write an already existing class. Value 'X' means an existing class will be overwrit- ten.                                                                                                                                                                                                                                         |
| IV_CORRNR         |              | Transport request where changes should be logged                                                                                                                                                                                                                                                                                                                       |
Export Parameters
| Parameter Name     | Field Name   | Value Help                                                                                 |
|--------------------|--------------|--------------------------------------------------------------------------------------------|
| ET_ERRORS          | ET_ERRORS    | 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                                                                  |
| ET_SYNT_ERRORS     |              | Syntax errors raised during generation of class. Check syntax of generated class directly. |
| ET_SYNT_ERROR_LONG |              | Syntax errors raised during generation of class. Check syntax of generated class directly. |
##  Sample Code
```
CLASS zcl_chdo_update_object DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_oo_adt_classrun. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_chdo_update_object IMPLEMENTATION. METHOD if_oo_adt_classrun~main. DATA: rt_errors             TYPE if_chdo_object_tools_rel=>TY_TR_ERROR_TAB, lt_errors_err         TYPE LINE OF if_chdo_object_tools_rel=>TY_TR_ERROR_TAB, lt_tcdob              TYPE iF_CHDO_OBJECT_TOOLS_REL=>TY_TCDOBDEF_TAB, P_IT_TCDOB            TYPE iF_CHDO_OBJECT_TOOLS_REL=>TY_TCDOBDEF_TAB, P_IT_TCDOBT           TYPE IF_CHDO_OBJECT_TOOLS_REL=>TY_TCDOBTEXT_TAB, P_IT_TCDRP            TYPE IF_CHDO_OBJECT_TOOLS_REL=>TY_TCDGEN, lt_tcdobt             TYPE IF_CHDO_OBJECT_TOOLS_REL=>TY_TCDOBTEXT_TAB, ls_tcdob              TYPE LINE OF iF_CHDO_OBJECT_TOOLS_REL=>TY_TCDOBDEF_TAB, ls_tcdobt             TYPE LINE OF IF_CHDO_OBJECT_TOOLS_REL=>TY_TCDOBTEXT_TAB. data: lr_err                TYPE REF TO cx_chdo_generation_error. ls_tcdob-tabname = 'ZCHDO'. ls_tcdob-multcase = 'X'.
```
```
ls_tcdob-docudel = ' '. ls_tcdob-docuins = ' '. ls_tcdob-docud_if = ' '. APPEND ls_tcdob TO p_it_tcdob. ls_tcdobt-lang_key = 'D'. ls_tcdobt-object_text = 'Single Case: Update'. APPEND ls_tcdobt TO p_it_tcdobt. p_it_tcdrp-author = sy-uname. p_it_tcdrp-textcase = 'X'. p_it_tcdrp-devclass = <development class>'. CLEAR: rt_errors, lr_err. TRY. cl_chdo_object_tools_rel=>if_chdo_object_tools_rel~update_object( EXPORTING iv_object          = 'ZCHDO_TEST' it_cd_object_def   = p_it_tcdob it_cd_object_text  = p_it_tcdobt is_cd_object_gen   = p_it_tcdrp iv_cl_overwrite    = 'X' iv_corrnr          = '<transport request>' IMPORTING et_errors          = rt_errors ). CATCH cx_chdo_generation_error INTO lr_err. ENDTRY. IF lr_err 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 updated | ). ENDIF. ENDIF. ENDMETHOD. ENDCLASS.
```