If you want to restrict creation of transports (and their release to further systems) based on rules applied on a transport description, you can use method described in this example.
Transport request descriptions are not checked anyhow by default. But if you have a system, where you e.g. link the transports you’re creating to a QM notification, you might want to restrict the format of the transport description.
This can be achieved by running TCode SE18 and implementing BAdI called CTS_REQUEST_CHECK and its methods CHECK_BEFORE_CREATION and CHECK_BEFORE_RELEASE.
For your reference, here’s a list of BAdIs available regarding transport request checks:
- CTS_REQUEST_CHECK (Request checks)
- CTS_EXPORT_FEEDBACK (Feedback after export of a transport request)
- CTS_IMPORT_FEEDBACK (Feedback after import of transport requests)
- CTS_INT_REQUEST_CHCK (Internal: Request Checks)
- CTS_TASKDOC_TEMPLATE (Determine template for the task documentation)
- CTS_CURRENT_PROJECT (Determine the current CTS project)
- CTS_ES_TADIR_POPUP (Screen BAdI of TADIR Dialog Box)
Let’s assume you have a rule that each transport must have it’s description in format
Now you just have to implement method CHECK_BEFORE_CREATION where initially we extract the QM notification number from transport description. This number is then checked by BAPI_QUALNOT_GETDETAIL for it’s existence in system which prevents users from creation of a transport without providing a correct QM notification number.
DATA: lv_notif TYPE string, lv_text TYPE string, lv_qmnum TYPE qmnum, lt_bapiret TYPE TABLE OF bapiret2. * Extract Notification - be aware of translation transports!!! * Translation transport (TCode SLXT) automatically prepends * description text like: 'LANG enUS' - this part will be ignored if text(4) = 'LANG'. shift text LEFT by 10 PLACES. endif. SPLIT text AT space INTO lv_notif lv_text. IF lv_notif IS INITIAL. MESSAGE 'Please provide QM notification' TYPE 'E'. RAISE cancel. ENDIF. CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT' EXPORTING input = lv_notif IMPORTING output = lv_qmnum. * Make sure the given QM notification exist CALL FUNCTION 'BAPI_QUALNOT_GETDETAIL' EXPORTING number = lv_qmnum TABLES return = lt_bapiret. LOOP AT lt_bapiret TRANSPORTING NO FIELDS WHERE type CA 'EA' MESSAGE 'Please provide valid QM notification' TYPE 'E'. RAISE cancel. ENDLOOP.
Of course you are able to create a transport using QM notification number you manually find in QM system and then you just rename the transport afterwards to some free text.
To prevent releasing transport with such modified description you have to check the transport name also at time of it’s release to further system. This is done by implementing the second BAdI method called CHECK_BEFORE_RELEASE e.g. like this:
DATA: lv_att TYPE SCTS_ATTRS. CALL METHOD me->if_ex_cts_request_check~check_before_creation EXPORTING type = type CHANGING text = text attributes = lv_att EXCEPTIONS cancel = 1 others = 2. IF sy-subrc <> 0. RAISE cancel. ENDIF.