Method
COPY_CONSTRUCTOR
You can use this method to copy objects from the BRF transaction. This method must be implemented with new objects that have been implemented. In principle, the method creates a copy of itself and replaces the name of the object in all the appropriate places. The result of the method is a maintenance instance of the new object.
Sample coding of class CL_CASE_EXPRESSION_MNT_BRF:
* base data definition
DATA: ls_brf150 TYPE sbrf150,
lv_subrc TYPE sysubrc,
lv_edit_mode TYPE brf_edit_mode,
lv_dummy.
* specific data definition
DATA: lo_new_object TYPE REF TO cl_case_expression_mnt_brf,
ls_brf136 TYPE sbrf136.
DATA lo_msg_handler TYPE REF TO if_message_handler_brf.
* get global message handler
lo_msg_handler = cl_msg_handler_pool_brf=>get_msg_handler( ).
*---------------------------------------------------------------------*
* handling for each expression type *
*---------------------------------------------------------------------*
CREATE OBJECT lo_new_object.
MOVE-CORRESPONDING ds_brf150 TO ls_brf150.
CLEAR ls_brf150-fdt_uuid.
ls_brf150-expression = iv_new_object.
ls_brf150-created_by = sy-uname.
ls_brf150-changed_by = sy-uname.
CONVERT
DATE sy-datum TIME sy-uzeit
INTO TIME STAMP ls_brf150-created_at TIME ZONE 'UTC '.
CONVERT
DATE sy-datum TIME sy-uzeit
INTO TIME STAMP ls_brf150-changed_at TIME ZONE 'UTC '.
CALL METHOD lo_new_object->init
EXPORTING
iv_edit_mode = lv_edit_mode
is_header = ls_brf150.
*---- do the enqueue check --------------------------------------------
CALL METHOD cl_mnt_services_brf=>enqueue_check
EXPORTING
iv_mnt_instance = lo_new_object
CHANGING
cv_edit_mode = lv_edit_mode
cv_subrc = lv_subrc.
IF lv_subrc NE 0.
*---- exit copy for the current instance --------------------------
MESSAGE s311(brf) WITH ds_brf150-expression INTO lv_dummy.
lo_msg_handler->add_message( ).
RAISE copy_error.
ENDIF.
*---------------------------------------------------------------------*
* handling of specific expression data *
*---------------------------------------------------------------------*
MOVE-CORRESPONDING ds_brf136 TO ls_brf136.
ls_brf136-expression = iv_new_object.
CALL METHOD lo_new_object->set_detail_data
EXPORTING
is_brf136 = ls_brf136
it_when_matrix = mt_when_matrix.
eo_mnt_instance = lo_new_object.