Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member216029
Participant

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.‟

   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‟

 

     Provide the following parameters for the method SCI_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'


  9. Finally create the message class „ZSCI‟ with the following values

  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


17 Comments
0 Kudos

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

Former Member
0 Kudos

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

OttoGold
Active Contributor
0 Kudos

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 Kudos

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

Former Member
0 Kudos

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_LOG-LEVEL    = '02'.

         LS_LOG-AG       = 'EU'.

         LS_LOG-MSGNR    = '901'.

         LS_LOG-NEWOBJ   = ABAP_FALSE.

         LS_LOG-LANGU    = 'EN'.

         LS_LOG-VAR1     = 'some important information here'

         LS_LOG-SEVERITY = 'S'.

         APPEND LS_LOG TO LT_LOG.


*then call some transform function - I don't know exactly what it does :sad:


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.

former_member220028
Active Contributor
0 Kudos

TR_INSPECT_OBJECTS is exaclty what i was looking for - thx

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

 
Former Member
I also could not find the attachment for ‘sci_check.txt.zip‘ in your blog.

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

 

 

 

SuhaSaha
Advisor
Advisor
0 Kudos

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 Kudos
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.

 
former_member191441
Participant
0 Kudos
 

I also could not find the attachment for ‘sci_check.txt.zip‘. Would you be so kind to indicate where this can be obtained as I have already done most work and now I am stuck at the step to add the code to the SCI_check method.

I will be appreciated.

 
former_member358468
Discoverer
0 Kudos
Hi mahadevan.venkata

Could you attach the file sci_check.txt.zip.

Regards,

Dani
0 Kudos
Hi Mahadevan Venkata

 

Can you please add the file sci_check.txt.zip.

Kind regards

Shanté

 
klaus_ellinger
Newcomer
0 Kudos
Hi Mahadevan Venkata

 

I agree with the other comments - with the attachment sci_check.txt.zip the blog would be really helpful. Can you please add the file sci_check.txt.zip?

 

Kind regards

Klaus
rameez_khan
Active Participant
Isn't it same as note: 2495410. ?
former_member216029
Participant
Hi All,

The blog is slightly outdated and further the text file containing the code got deleted during migration(to community) of the website.

However, the good news is that this feature is now available as an SAP standard.

Please read the note 2495410 to get more information on how to activate this.

Happy releasing more tasks/requests 🙂

Best Regards

Mahadevan

 
Labels in this area