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
- Go to transaction SE03
- Double click on the entry ‘Global Customizing’ (Transport Organizer)
- 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
- Go to transaction SE19
- At the create implementation box provide the name of the classic BAdI „CTS_REQUEST_CHECK‟ and click on the button „Create Impl.‟
3. Provide a BAdi implementation name
4. Provide a short text. Click on the „Save‟ button. Provide package details when prompted
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.
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’
7. For calling the actual Code inspector check itself create a new private method sci_check in the class „ZCL_IM__CTS_REQUEST_CHECK‟
create the method exception
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’
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