Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 

Code Inspector and ATC (ABAP Test Cockpit) are tools that help developer and quality managers to check and control the quality of ABAP code, both code inspector and ATC check can be triggered during TR release, and also integrated with ChaRM. However when integrated with ChaRM, behaviors are different:

  • Code inspector:

Action “pass change to test” will be failed due to code inspector check error, but error message is quite general to tell the exact fail reason;

Transport request is released;

  • ATC,

Action is cancelled directly (without saving of action) with clear error message telling that code inspector (ATC) checked with error

Transport request is still open



Code Inspector

To configure code inspector as a mandatory check on release:

  SE03 -> Global Customizing (Transport Organizer) -> Panel “Check Objects when Request Released” -> Globally Activated


when ChaRM is used, for example you do the transport release by executing action “Pass Urgent Change to Test” in Urgent Change, the action will be failed. But the error you get is like normal import error: ‘Action Import Transport Request in System xxx has been cancelled’, no information to tell whether it is code inspector error.

ATC

First you also have to set the global customizing in SE03.

  ATC can be centrally configured and executed in T-Code ATC. In ATC configuration you can choose the system behavior shall be taken when TR has quality errors, only inform or to block the transport release

Choose block in case you want to make it as a Q-Gate control.

If ChaRM is used, when you execution the action “Pass Urgent Change to Test” in UC document

Without clicking ‘Save’, you will get error message: Code inspector errors in transport request ERDK900136. Cannot release, thus you will be reminded that you have ATC check errors in the TR objects, you have to fix it. And the TR is still open.

Technical details when using ATC

When the action “Pass Urgent Change to Test” is triggered, event EH_ONDYNACTION in class CL_AIC_CMCD_AICCMCDOVERVI_IMPL is triggered, and below code is executed.

  "Preapare transpor request release

  prepare_release_request(

    EXPORTING

      is_action            = ls_action

    RECEIVING

      rv_release_request   = lv_release_req

    EXCEPTIONS

      err_with_document    = 1

      OTHERS               = 2 ).

  IF sy-subrc <> 0.

    RETURN

  ENDIF.

And within this form, finally READ_TRANSP_REQUEST_INFO (/TMWFLOW/CL_TRANSPORT) is called, and within this function:

*** Check Code Inspector for ABAP system

      IF iv_code_inspector = abap_true

        AND ls_sys_rfc-code_inspctor = abap_true.

        CALL FUNCTION 'TMW_INSPECT_OBJECTS'

          DESTINATION ls_sys_rfc-rfc_dest

          EXPORTING

            iv_trkorr             = <fs_transp_req>-trorder_number

          IMPORTING

            ev_error_type         = lv_inspec_err_type

          EXCEPTIONS

            communication_failure = MESSAGE lv_rfc_msg_text

            system_failure        = MESSAGE lv_rfc_msg_text

            invalid_request       = 3

            OTHERS                = 4.

        CASE sy-subrc.

          WHEN 0."Do nothing.

          WHEN 1.

            MESSAGE e106(/tmwflow/track_n)      "error RFC destination

               WITH ls_sys_rfc-rfc_dest  lv_rfc_msg_text

                    lv_rfc_msg_text+50 INTO lv_msg_txt.

            add_system_message( CHANGING ct_err_message = et_err_message ).

            RAISE error_found.

          WHEN 2.

            MESSAGE e107(/tmwflow/track_n)      "system cancel RFC destination

                 WITH ls_sys_rfc-rfc_dest  lv_inspector_name

                      lv_rfc_msg_text lv_rfc_msg_text+50 INTO lv_msg_txt.

            add_system_message( CHANGING ct_err_message = et_err_message ).

            RAISE error_found.

          WHEN OTHERS.

            add_system_message( CHANGING ct_err_message = et_err_message ).

            RAISE error_found.

        ENDCASE.

        "Display the error message according to error type

        CASE lv_inspec_err_type.

          WHEN '1'."relevant faults for release -> cancel the release

            "Code inspector errors found in request &1; release not possible

            MESSAGE e021(ai_crm_cm_message)

              WITH <fs_transp_req>-trorder_number INTO lv_msg_txt.

            add_system_message( CHANGING ct_err_message = et_err_message ).

            <fs_transp_req>-code_inspect_chk = c_tr_code_inspec_err.

          WHEN '2'."not relevant faults for release -> display as warning

            "Code inspector errors found in request &1; release still possible

            MESSAGE w022(ai_crm_cm_message)

              WITH <fs_transp_req>-trorder_number INTO lv_msg_txt.

            add_system_message( CHANGING ct_err_message = et_war_message ).

            <fs_transp_req>-code_inspect_chk = c_tr_code_inspec_war.

          WHEN OTHERS.

        ENDCASE.

      ENDIF.

The remote function TMW_INSPECT_OBJECTS is then triggered in managed system to run code inspection (ATC) check. If return error type is 1, the message above we saw in CRM UI will be popped up. But why when using code inspector, we don’t have this message? As we see in above coding, in function READ_TRANSP_REQUEST_INFO, actually they do handled the error type 2, they will raise error 22 which is “Code inspector errors found in request &1; release still possible” , But finally this error message is not handled in event of class CL_AIC_CMCD_AICCMCDOVERVI_IMPL.

  For the RFC TMW_INSPECT_OBJECTS in managed system, why it returns error type 1 when we are using ATC (actually when ATC is configured to block transport), and error type 2 in case we only use Code Inspector (actually here ATC is not available, or configured as inform instead of block). Because it read configuration from table TRCHECK.

In ATC configuration, when you choose “E Block on any error (priority 1 and 2)”, the error type will be set to 1 which means TR cannot be released, and if you choose “X Inform on errors (priority 1 and 2)”, the error type will be set to 2 which means TR can be released (same as code inspector behavior).

*  Errors occured?

  IF ps_result-errors > 0 OR ps_result-critical_errors > 0.

    IF pv_severity = 'E' AND pv_error_type <> '1'.

      pv_error_type = '1'.

    ELSEIF pv_severity = 'C' AND ps_result-critical_errors > 0.

      pv_error_type = '1'.

    ELSE.

      IF pv_error_type <> '1' AND pv_error_type <> '2'.

        pv_error_type = '2'.

      ENDIF.

    ENDIF.

  ENDIF.

  Technical Prerequisite for tools

All above configuration we mentioned is on managed system (D system). Code Inspector and ATC are tools delivered with basis component.

Code Inspector

SAP Basis release > 620, code inspector is ready, below document is a good reference.

ATC

ABAP Test Cockpit (ATC)

available with EhP2 for SAP NetWeaver 7.0 support package stack 12 (SAP Basis 7.02, SAP Kernel 7.20)

available with EhP3 for SAP NetWeaver 7.0 support package stack 5 (SAP Basis 7.31, SAP Kernel 7.20).