BADI_CHECK_BEFORE_RELEASE
This user exit can be used e.g. to force developers to provide mandatory information for a transport request before it can be exported via SE01, SE09, SE10. It is called before the selection of the project/destination for the request and can thus also be used to restrict the selectable project/destinations based on individual situations.
Location for activation
Development system
Template function Module
/RTC/TM_TMPL_ BADI_BEFORE_REL
Interface
Import Parameters
Internal Table LT_TRKORR
(contains only 1 record)
Field | Description |
---|---|
TRKORR | Transport Request |
TRFUNCTION | Type of the Transport Request (e.g. ‘K’=Workbench, ‘W’=Customizing, ‘T’=Transport of Copies) |
TRSTATUS | Status of the transport request following E070-TRSTATUS |
TARSYSTEM | Target system of the request in SAP TMS |
KORRDEV | ‚SYST’ = Workbench, ‚CUST’ = Customizing |
AS4USER | Owner of the request |
AS4DATE | Last changed date |
AS4TIME | Last changed time |
STRKORR | If TRKORR is a task, STRKORR contains the transport request the task is assigned to |
TEXT | Short text |
Internal Table LT_E070A
Field | Description |
---|---|
ATTRIBUTE | SAP Attributes, which should be assigned to the request |
REFERENCE | SAP Attribute values, which should be assigned to the request |
Export Parameters
Parameter | Type | Shorttext |
---|---|---|
LV_RETCODE | SY-SUBRC | 0: Export process continues |
LV_MSGTEXT | /rtc/tm_param-value | Message, that should appear in case of sending return code > 0. |
LV_DISPL_SEL | CHAR1 | ‘X’ (default): Provide selection popup for project/destination ‘ ‘: Don’t display selection popup and release request w/o insertion into TM |
LV_SUPPR_MESS | CHAR1 | ‘X‘: Don’t display standard message “Request will be released only and not inserted into TM” ‘ ‘: Display the standard message |
LV_ASSIGNMENT | CHAR1 | Controls the select options in project/destination popup: ‘1’: Only project/destination can be selected, no packages ‘2’: Project/destinations as well as packages can be selected ‘3’: Only packages can be selected Default value: As defined in transaction /RTC/TM_BADI |
Example
If the request contains at least one role, the project/destination popup should only provide projects that match with “*ROLES*”
Step 1 | Copy the function module /RTC/TM_TMPL_ BADI_BEFORE_REL to a new function module |
Add the following code to the section “Begin of customer implementation”:
FIELD-SYMBOLS: <lw_trkorr>.
DATA: lv_object TYPE E071-OBJECT.
DATA: lw_sel_opt TYPE /RTC/TM_SEL_OPT.
* lt_trkorr can only contain 1 record here
LOOP AT lt_trkorr ASSIGNING <lw_trkorr>.
SELECT object FROM E071 INTO lv_object
WHERE object = ‘ACGR’.
EXIT.
ENDSELECT.
IF sy-subrc = 0.
lw_sel_opt = sy-uname.
lw_sel_opt -from_date = sy-datum.
lw_sel_opt -to_date= sy-datum.
lw_sel_opt -tabname = ‘/RTC/TM_PDATA’.
lw_sel_opt -fieldname = ‘PJ_NAME’.
lw_sel_opt -counter = ‘999’.
lw_sel_opt -sign = ‘I’.
lw_sel_opt -option = ‘CP’.
lw_sel_opt -low = ‘*ROLE*’.
INSERT INTO /RTC/TM_SEL_OPT VALUES lw_sel_opt.
ENDIF.
ENDLOOP.
Please note: table /RTC/TM_SEL_OPT can be used to restrict possible project/destinations permanently on an individual dev system. Restrictions can be defined user and time dependent.
This table can also be used for dynamic restrictions as in the example above. Just take care to set the COUNTER value to a value > 900. TM standard coding will delete those records right after the selection popup as it identifies them as temporary…
In opposite, if you want to restrict some projects/destinations permanently, maintain /RTC/TM_SEL_OPT directly via SE16 and use COUNTER values < 900.