How To Check Transport Request Dependencies?

In SAP development, transport requests are used to move changes (customizations, programs, configurations, etc.) across different clients, such as from development to quality assurance and then to production.

But when you’re working with several developers then many times you will find yourself updating other people’s work, resulting different TR numbers generated for the same project.

The bad news is that sometimes your own TR number doesn’t have all the objects required for the project because some of it are included in different TR numbers. That is why managing transport requests effectively is critical to avoid missing TR numbers, ensure system stability and consistency.

In this tutorial, we will learn the importance of making sure the completeness of your TR numbers before transporting them into the production server.

Tutorial Objectives
1. Learn how to avoid missing TR numbers.
2. Learn how to implement BAdI for execute TR dependency checks.
3. Integrate TR dependency check with ABAP before releasing the TR.
Prerequisites
1. SAP System Access: SAP GUI, ECC
2. Authorization: Developer Role, TCODES: SE01, SE10, SE18.

Why Bother With Transport Requests Check?

Checking transport request dependencies is particularly important for several reasons:

1. Avoiding Missing Transport Requests

I’m sure that you’ve likely experienced situations where you worked on a project alongside multiple developers. In such scenarios, it’s not uncommon for a transport request to be missed during deployment to the production system. Since you may not have complete visibility into what other developers are working on, this oversight can lead to runtime errors in production and unfortunately, you might end up taking the blame for the issue.

2. Enforcing Logical Sequence of Changes

We’re all know that SAP transport requests are sequential in nature and changes often build upon one another. So by having a proper dependency management, it ensures that the sequence of changes is maintained, preventing failures caused by missing prerequisites.

3. Avoiding Downtime Issue

Unchecked dependencies might lead to failed deployments, requiring rollbacks or emergency fixes. If you work in a service based industries than the cost for system downtime is very expensive. That’s why a proper dependency checks will ensure smoother transports, minimizing or even eliminating downtime and disruption.

Solution: BAdI For Transport Request Check

The solution is to implement BADI Interface: CTS_REQUEST_CHECK in method: CHECK_BEFORE_RELEASE. This BADI will Check your TR request number for its dependencies with another TR (cross reference) and also its sequential check before releasing the TR numbers.

Now let’s talk about the most common scenario when dealing with incomplete transport requests which is the cross reference dependency issues

Case Scenario: Cross Reference Dependency Check

Let’s say developer A write a program to create data entry into a custom ZTEMPLOYEES table as shown below:

From the project above we will have 2 objects in the transport request number (*7982), the ZEMPLOYEES table and also the ZEMPDATA program.

After a while, developer B come and create a new ABAP program to update the table as shown below.

Developer B will have his own Transport number (*7984) but with only one object which is ZEMPDATA_UPDATE.

Releasing The TR Number

When developer B attempts to release his transport request (TR:*7984) he will encounter a Cross Reference Check error. This notification is triggered by the system’s dependency validation, indicating that the objects in developer B’s TR rely on objects in another transport request that has not yet been released or moved to the target system which is TR number *7982.

So here’s the correct way to release the TR:

  1. Release TR: *7982
  2. Release TR: *7984
  3. Combine Both TRs.

Without using TR Checking, you can still release TR:*7984 and transport the TR number to production client, but your basis team will inform you about the error as shown below.

Unfortunately, since the program has already been copied into the destination client and is accessible to the user, but the dependent transport request (7982) has not been imported, can you guess what happened next?

It’s Every Developer’s Worst Nightmare!

To save yourself from this kind of headache, consider implementing a Transport Request (TR) Check System in your SAP development environment. This preventive action ensures dependencies are validated, so you can avoid having issues like runtime errors, system disruptions, and frantic last minute fixes.

So here’s what I can help you with, a transport request check that integrated with your TMS.

ABAP Code Example: Transport Request Check

The standard ABAP program used in this source code is: /SDF/CMO_TR_CHECK

Next, we will implement the BAdI: CTS_REQUEST_CHECK, which will be triggered whenever a user attempts to release a transport request (TR). This enhancement helps validate dependencies and ensures the transport request meets all prerequisites before being released. Follow these steps to implement it successfully:

Step 1. Execute TCODE: SE18, enter CTS_REQUEST_CHECK. Click the Display button.

Step 2. Go to Implementation -> Create

Step 3. Enter the implementation name: ZBADI_REQUEST_CHECK

Step 4. Enter the Short Text, double click method: CHECK_BEFORE_RELEASE

Step 5. Copy this source code, Save and Activate.

  method IF_EX_CTS_REQUEST_CHECK~CHECK_BEFORE_RELEASE.
*& ABAP Code Example: Check TR Number Dependencies
*& Source: ABAPGeek.com

  DATA:
    lr_transports    TYPE RANGE OF e070-trkorr,
    lv_answer        TYPE char1,
    lf_perform_check TYPE xfeld.

  CONSTANTS:
    co_none       TYPE rfcdes-rfcdest VALUE 'NONE',

*& these are RFCs to access your QA and Production client
*& You have to maintain them first in SM59

    co_qa         TYPE rfcdes-rfcdest VALUE 'TR_COMPARE_QA_CLIENT',
    co_production TYPE rfcdes-rfcdest VALUE 'TR_COMPARE_PROD_CLIENT'.

*& After developer release the TR, he will be prompted with a dialog
*& asking if he wants to perform TR checking

  CALL FUNCTION 'POPUP_TO_CONFIRM'
    EXPORTING
      titlebar              = 'TR Checking'
      text_question         = 'Do you want to perform TR Checking?'
      display_cancel_button = abap_true
    IMPORTING
      answer                = lv_answer
    EXCEPTIONS
      text_not_found        = 1
      OTHERS                = 2.
  IF lv_answer EQ '1'.

*& Developer can choose between QA and Production client
    CLEAR: lv_answer.
    CALL FUNCTION 'POPUP_TO_CONFIRM'
      EXPORTING
        titlebar              = 'Target system'
        text_question         = 'Please choose target system!'
        text_button_1         = 'QA'
        text_button_2         = 'PROD'
        display_cancel_button = abap_true
      IMPORTING
        answer                = lv_answer
      EXCEPTIONS
        text_not_found        = 1
        OTHERS                = 2.

    CASE lv_answer.
      WHEN '1'.
        DATA(lv_rfc) = co_qa.
      WHEN '2'.
        lv_rfc = co_production.
      WHEN OTHERS.
    ENDCASE.

    SELECT SINGLE strkorr
      FROM e070
      INTO @DATA(lv_main_transport)
     WHERE trkorr EQ @request.
    IF sy-subrc IS NOT INITIAL.

    ENDIF.

    CLEAR: lr_transports[].
    "---- Collect TR in range
    APPEND VALUE #( sign = 'I' option = 'EQ' low = lv_main_transport ) TO lr_transports.
    APPEND VALUE #( sign = 'I' option = 'EQ' low = request ) TO lr_transports.

    "Call SAP standard program to check the TR
    SUBMIT /sdf/cmo_tr_check
      WITH p_source EQ co_none           "-- Source System
      WITH p_target EQ lv_rfc            "-- Target System
      WITH r_prj_co EQ abap_true         "-- Check TR
      WITH p_ori_tr IN lr_transports     "-- Give TR number
      WITH p_crsref EQ abap_true         "-- Cross reference
      WITH p_dgp    EQ abap_true         "-- Sequence Check
      WITH p_swcomp EQ abap_true         "-- Cross release
      WITH p_imptim EQ abap_true         "-- Import Time in source
      WITH p_oichck EQ abap_true         "-- Online import check
    AND RETURN.

    CLEAR: lv_answer.

*& Upon showing the TR check result, the user will be prompted with
*& a dialog to release the TR
    CALL FUNCTION 'POPUP_TO_CONFIRM'
      EXPORTING
        titlebar              = 'Release Transport Request'
        text_question         = 'Continue to release TR?'
        display_cancel_button = abap_true
      IMPORTING
        answer                = lv_answer
      EXCEPTIONS
        text_not_found        = 1
        OTHERS                = 2.
    IF sy-subrc <> 0.
      CLEAR: lv_answer.
    ENDIF.

    IF lv_answer EQ '1'.
      "Release the TR
    ELSE.
      "Cancel The Release
      RAISE cancel.
    ENDIF.
  ENDIF.
  endmethod.

Step 6. Don’t forget to activate the BADI so the implementation will be called.

Test The Transport Request Checks Program

Now every time developers release the TR, they will be prompted with a pop up message confirming whether or not they want to do the TR checking.

If they click on Yes, the second pop up window will ask the developer to choose which client to do the checking.

If everything is okay then every tab will have a green check mark. Next click the Back Button.

Next, the developers click the BACK button and the last pop up window will be prompted asking to continue with the TR release.

Suggestion: You can include this procedure into your SOP for releasing the TR numbers. So every developer should include the success TR check result in order to be approved by the basis team or your leaders.

Summary

By integrating a TR check system ( using BAdIs: TS_REQUEST_CHECK), you can ensuring the stability, reliability, and a smoother development lifecycle and most importantly, a good night sleep.

SAP Reference: TMS.

Share this tutorial with Fellow Geeks!

Other ABAP Tutorials

Leave a Reply

Your email address will not be published. Required fields are marked *