Skip to content

Latest commit

 

History

History
57 lines (37 loc) · 2.23 KB

archiving-change-documents-8b8c4a4.md

File metadata and controls

57 lines (37 loc) · 2.23 KB

Archiving Change Documents

You can archive change documents together with their application documents.

  1. A change document object is available (see Working with Change Document Objects) and it's implemented to create change documents (see Writing Change Documents).
  2. There is an archiving object to archive current application documents (see Working with Archiving Objects.
  1. Add the archiving class CHANGEDOCU to the archiving classes of your archiving object using ABAP Development Tools (ADT):

  2. Update the write class of your archiving object to archive change documents.

    Sample Code:

    CLASS ZCL_<YOUR_ARCH_OBJECT>_WRI IMPLEMENTATION.
    METHOD if_apj_rt_exec_object~execute.
    …
    TRY.
    DATA(lo_write) = cl_arch_write_api=>get_instance( iv_archiving_object = <YOUR_ARCH_OBJECT> iv_testmode = lv_test ).
    LOOP AT lt_keys_tab ASSIGNING FIELD-SYMBOL(<fs_keys>).
    lo_write->open_data_object( ).
    cl_changedocu_archive=>get_instance( )->if_changedocu_archive~changedocu_archive_object( iv_objectclass = <YOUR_CD_OBJECTCLASS>
    iv_objectid = <fs_keys>-objectid
    iv_write_instance = lo_write ).
    lo_write->close_data_object( ).
    ENDLOOP.
    lo_write->finalize( ).
    CATCH cx_arch_api INTO DATA(lx_error).
    CATCH cx_chdo_archive_error INTO DATA(lx_error2).
    ENDTRY.
    ENDMETHOD.
    

    Note:

    String <YOUR_ARCH_OBJECT> is for your archiving object. String <YOUR_CD_OBJECTCLASS> is for your change document object.

    Note:

    To read change documents from the archive, consider Reading Change Documents.