BADI_CHECK_BEFORE_CREATION

This user exit can be used e.g. to force developers to provide mandatory information for a transport request while it is created.

Location for activation

Development system

Template function Module

/RTC/TM_TMPL_ BADI_CREATION

Interface

Import Parameters

Internal Table LT_TRKORR

Field

Description

Field

Description

TRFUNCTION

Type of the Transport Request (e.g. ‘K’=Workbench, ‘W’=Customizing, ‘T’=Transport of Copies)

TEXT

Short text

 

Internal Table LT_ATTR

Field

Description

Field

Description

ATTRIBUTE

SAP Attributes, which should be assigned to the request

VALUE

SAP Attribute values, which should be assigned to the request

 

Export Parameters

Parameter

Type

Shorttext

Parameter

Type

Shorttext

LV_RETCODE

SY-SUBRC

0: Request will be created
> 0: Request creation will be cancelled

LV_MSGTEXT

/rtc/tm_param-value

Message, that should appear in case of sending return code > 0.

 

Example

Developers are forced to assign a tester for the new transport request. The tester should be stored as a TM attribute and can thus be used later to notify this tester after a certain workflow step (e.g. after import into QA he or she will be notified about the new arrived request and that it is ready for test).

Step 1

Copy the function module /RTC/TM_TMPL_ BADI_CREATION to a new function module

 

Add the following code to the section “Begin of customer implementation”:

data: lt_attrib03 type table of /rtc/tm_attrib03. data: lw_attrib03 type /rtc/tm_attrib03. data: lv_ref(30). data: lw_ref type /rtc/tm_stihl_rf. data: lv_name type /rtc/tm_stihl_pc-bname. data: lv_go. clear lv_go. select bname from /rtc/tm_stihl_pc into lv_name. exit. endselect. if sy-subrc ne 0. lv_go = 'X'. else. select single bname from /rtc/tm_stihl_pc into lv_name where bname = sy-uname. if sy-subrc = 0. lv_go = 'X'. endif. endif. if lv_go = 'X'. * Call individual function module to retrieve customer specific attributes … * CALL FUNCTION … if sy-subrc ne 0. lv_retcode = 8. lv_msgtext = 'Request creation canceled!'. else. loop at lt_attr into ls_attr. tt_export_params-name = 'ATTRIBUTE'. tt_export_params-value = ls_attr-attribute. append tt_export_params. tt_export_params-name = 'REFERENCE'. tt_export_params-value = ls_attr-value. append tt_export_params. endloop. concatenate sy-uname sy-datum sy-uzeit into lv_ref. tt_export_params-name = 'ATTRIBUTE'. tt_export_params-value = 'Z_TM_REFERENCE'. append tt_export_params. tt_export_params-name = 'REFERENCE'. tt_export_params-value = lv_ref. append tt_export_params. lw_ref-tm_ref = lv_ref. loop at lt_attrib03 into lw_attrib03 where value ne space. lw_ref-attribute = lw_attrib03-attr_name. lw_ref-value = lw_attrib03-value. insert into /rtc/tm_customer_rf values lw_ref. endloop. endif. endif.