Following are the steps for implementing ATC into the system during Task Release.
1. Goto transaction 'SCI' and create a variant of 'Global Type'
1. Goto transaction 'SCI' and create a variant of 'Global Type'
2. Goto transaction 'ATC' and double click on 'Configure ATC'
3. Set the configuration as mentioned below. In the 'Global Check Variant', provide the name of the variant that has been created in step 1. Here, it is 'ZTEST_VARIANT'.
4. The table 'SCICHKV_ALTER' stores the default check variant for Code Inspector.
Default - This variant is used during normal checking like we do in SE38
Transport - This variant is used during transport release
Change the value of these two records with the new custom variant that has been created in step 1.
5.Goto transaction SE19 and create a new implementation of BADI - CTS_REQUEST_CHECK.
6. In CHECK_BEFORE_RELEASE methods write the below codes:
METHOD if_ex_cts_request_check~check_before_release. DATA: lv_exit TYPE char10. CALL FUNCTION 'TRINT_TDR_USER_COMMAND' EXPORTING iv_object = request iv_type = 'TASK' iv_command = 'CHAO' IMPORTING ev_exit = lv_exit. DATA: lv_field TYPE char70. FIELD-SYMBOLS: <fs_okcode> TYPE any. lv_field = '(SAPLSTR7)GV_OKCODE'. ASSIGN (lv_field) TO <fs_okcode>. IF <fs_okcode> EQ 'CANC'. RAISE cancel. ENDIF. ENDMETHOD.
7. Now, while releasing the task, the pop-up will appear:
8. If the requirement is to directly open the ATC results then write the below codes in the method:
METHOD if_ex_cts_request_check~check_before_release. DATA is_ok TYPE abap_bool VALUE abap_true. TRY. DATA(or_factory) = NEW cl_satc_api_factory( ). DATA(it_objects) = cl_satc_object_set_factory=>create_for_transport( request )->if_satc_object_set~get_object_keys( ). DATA(or_objects) = cl_satc_object_set_factory=>create_for_object_keys( it_objects ). DATA(or_variant) = NEW cl_satc_ci_check_variant( ). or_variant->set_name( 'ZTEST_VARIANT' ). "check variant DATA(or_run_config) = or_factory->create_run_config_with_chk_var( EXPORTING i_object_set = or_objects i_check_variant = or_variant i_description = |Transport release { request } | ). DATA(or_run_controller) = or_factory->create_run_controller( or_run_config ). or_run_controller->run( IMPORTING e_result_access = DATA(or_result_access) ). or_result_access->get_findings( IMPORTING e_findings = DATA(it_f) ). LOOP AT it_f ASSIGNING FIELD-SYMBOL(<wa_f>) WHERE ( kind = 'E' OR kind = 'W' ) "errors/warnings AND exceptn <> 'P'. "pseudo comments and pragmas is_ok = abap_false. EXIT. ENDLOOP. CATCH cx_satc_failure cx_satc_not_found INTO DATA(cx). DATA(exc_text) = cx->get_text( ). MESSAGE exc_text TYPE 'E'. is_ok = abap_false. CATCH cx_satc_empty_object_set cx_satc_invalid_argument INTO cx. "ok, if transport is empty or contains only non-checkable objects ENDTRY. IF is_ok = abap_true. MESSAGE s007(zs_dev_tools_local). "success message – create your own message ELSE. "we only get the execution ID with this “dirty” cast: DATA(or_result_access_int) = CAST cl_satc_result_access( or_result_access ). CALL FUNCTION 'SATC_AC_DISPL_RESULT_BY_EXEC' EXPORTING i_execution_id = or_result_access_int->if_satc_result_access~result_id EXCEPTIONS xpt_no_results = 1 xpt_not_authorized = 2 xpt_display_used = 3 OTHERS = 4. CHECK sy-subrc = 0. RAISE cancel. ENDIF. ENDMETHOD.
Now, whenever the task will be released automatically ATC results will be shown if there is any.
Reference Link:
No comments:
Post a Comment