Skip to Content

Bugs in your custom ABAP code can be quite expensive when they impact critical business processes, which is why quality assurance of custom ABAP code is receiving more and more attention in business. Detecting bugs early in the development stages before they can be moved across the landscape ensure that the cost and risk impact is minimal. To reach this goal, SAP offers the ABAP Test Cockpit (ATC) and Code Inspector as quality assurance tools.

The ATC is available with EhP2 for SAP NetWeaver 7.0 support package stack 12 (SAP Basis 7.02, SAP Kernel 7.20) and EhP3 for SAP NetWeaver 7.0 support package stack 5 (SAP Basis 7.31, SAP Kernel 7.20).

General process for releasing a transport request

The transport organizer is a tool for managing the objects that gather the changes carried on during the development and configuration phases, and for transporting them across the landscape. The two kinds of objects used are the Request and the Task.

The Request is the main container, which contains zero to any number of Tasks.The CTS automatically creates one task for each user who adds objects to the Request. An ABAP transport request may contain many tasks that are assigned to different users.When you want to transport the Request, you have to first release all the tasks of the request, and then the request itself. When it is released, the transport is done automatically or manually by the administrator. The transport goes towards the systems and clients defined in the transport routes.

Current behavior of Code Inspector checks during the release of a transport request or a transport task

Releasing a transport request or a task can be considered as the first quality gate to ensure that poor quality custom code is not transported across the landscape. Currently, Code Inspector checks can be activated during the release of a transport request. To activate this feature, perform the following steps

  1. Go to transaction SE03
  2. Double click on the entry ‘Global Customizing’ (Transport Organizer)
  3. Under ‘Check Objects when Request Released’ , select the option ‘Globally Activated’.

Now this activates the check of a transport request. But there may be the requirement to check also the single ‘tasks’. Currently, automatically triggering  Code Inspector checks during the release of a ‘task’ is not available as a standard. To address this requirement, SAP provides a standard BAdI ‘CTS_REQUEST_CHECK, that can be implemented by customers to trigger code inspector checks during the release of a task.

In this blog, I will illustrate the steps required to implement the BAdI, which when activated will trigger the checks during the release of a task.

(please adapt the naming conventions, texts, badi names, class names etc as per your requirement)

Steps for triggering Code Inspector Checks during the release of tasks

  1. Go to transaction SE19
  2. At the create implementation box provide the name of the classic BAdI „CTS_REQUEST_CHECK‟ and click on the button „Create Impl.‟

Image_1.png

   3. Provide a BAdi implementation name

/wp-content/uploads/2013/09/badi_impl_name_282622.png

   4. Provide a short text. Click on the „Save‟ button. Provide package details when prompted

/wp-content/uploads/2013/09/badi_short_text_282629.png

   5. Double clicking on the method ‚check_before_release„ of the BAdi interface takes you to the method implementation of the generated ABAP object class that was created during BAdi impl creation.

/wp-content/uploads/2013/09/5_badi_282632.png

   6. In the method „CHECK_BEFORE_RELEASE‟ first check if the release concerns a transport request or a transport task.Code the following portion in the method ‘CHECK_BEFORE_RELEASE’

Code1.PNG

     7. For calling the actual Code inspector check itself create a new private method sci_check in the class „ZCL_IM__CTS_REQUEST_CHECK‟

  /wp-content/uploads/2013/09/sci_chk1_282634.png

     Provide the following parameters for the method SCI_CHECK/wp-content/uploads/2013/09/sci_check2_282638.png 

     create the method exception

/wp-content/uploads/2013/09/sci_chk3_282639.png

  8. The rest of the method SCI_CHECK contains the various steps of creating Code inspector check, assigning variants, object sets etc.It is sufficient if you copy the piece of code from the attachment ‘sci_check.txt.zip’


  9. Finally create the message class „ZSCI‟ with the following values/wp-content/uploads/2013/09/msg_class_282651.png

  10. Save and activate all your changes. Do not forget to activate the BAdI implementation in transaction SE19.

* Deactivate the BAdI in SE19, if you do not wish to use this feature


To report this post you need to login first.

11 Comments

You must be Logged on to comment or reply to a post.

  1. Florian Wunderle

    Hi!

    Thkanks for sharing this. Shouldn’t it it have been better to use function module  TR_INSPECT_OBJECTS for doing the ATC check? In this case even the ATC exemption routines and the settings in ATC and SE03 would be valid.

    /Florian

    (0) 
  2. Adrian Pitu

    Hello!

    Great advices. I have a further question. How can I propagate my error message to the user interface. How can I make the user know why his transport was not executed and display the message in the logger window for errors and warnings.

    Thanks,

    Adrian

    (0) 
    1. Otto Gold

      Hello,

      ideal would be that you first turn on the standard Code Inspector integration in SE03 and there you will see how it works as an example. Then you can mimic that behaviour or change the behaviour but already knowing what you don’t want and where you are heading next.

      cheers Otto

      (0) 
    2. Florian Wunderle

      Hi!

      We are using the function module TR_INSPECT_OBJECTS for performing the checks. This raises the same type of message popup as in releasing the whole transport.

      /Florian

      (0) 
    3. Adrian Pitu

      I succeded to do my task as follows:

      DATA: LS_LOG                 TYPE SPROT_U,

               LT_LOG                 TYPE STANDARD TABLE OF SPROT_U,

               LT_LINES               TYPE TABLE OF TRLOG INITIAL SIZE 0.


      * add your logs to lt_log table


      CLEAR LS_LOG.

               LS_LOGLEVEL    = ’02’.

               LS_LOGAG       = ‘EU’.

               LS_LOGMSGNR    = ‘901’.

               LS_LOGNEWOBJ   = ABAP_FALSE.

               LS_LOGLANGU    = ‘EN’.

               LS_LOGVAR1     = ‘some important information here’

               LS_LOGSEVERITY = ‘S’.

               APPEND LS_LOG TO LT_LOG.


      *then call some transform function – I don’t know exactly what it does 🙁


      CALL FUNCTION ‘TRINT_CONVERT_LOG’

             TABLES

               IT_MSGS  = LT_LOG

               ET_LINES = LT_LINES.


      *and then show the error messages


      CALL FUNCTION ‘TRINT_DISPLAY_LOG’

             EXPORTING

               IV_TITLEBAR            = ‘your title here.’

             TABLES

               CT_LINES               = LT_LINES

             CHANGING

               CV_WITH_LONG_TEXT_ICON = LV_WITH_LONG_TEXT_ICON

             EXCEPTIONS

               OTHERS                 = 0.

      (0) 
  3. Hock Lin Wong

    Hi Mahadevan,

    I could not find the attachment for ‘sci_check.txt.zip‘ in your blog. Can you show me where should i get the the file?

    Thanks and Regards
    Wong

     

    (1) 
  4. Christian Pfaller

    Hi all,

    meanwhile it is also possible to release tasks/requests from Eclipse/ADT. Is there a way to integrate the CTS_REQUEST_CHECK BAdI also with ADT? I’d like to see the SCI results in Eclipse when releasing a task/request from ADT – ideally I’d like to choose to cancel or continue the release in case of SCI messages.

    Regards,

    Christian

     

     

     

    (1) 
    1. Suhas Saha

      The BAdI is called when you release a TR via ADT.

      The ATC is integrated with the ADT and you can trigger it for a TR as well.

      Context Menu > Run As > ABAP Test Cockpit

      BR,

      Suhas

      (0) 
      1. Christian Pfaller

        Yes, I’m aware of this, but I’d like to also see the Code Inspector results (from the BAdI call) when I release a task automatically in Eclipse (without separately executing ATC) – or at least a message displaying that errors / warnings did occur. That’s the benefit when implementing the BAdI: you can enforce executing the checks on task release.

        So may question is how to transfer result data from the BAdI to ADT?

        Then, the second step would be to popup a dialog if the release should be continued or not.

         

        (0) 

Leave a Reply