The “Create Defect” dialog in My Test Executions can be enhanced using the BAdI /SALM/TM_TWL_DEF_DIALOG_BADI. This is a multiple use BAdI with a filter on transaction type. Based on the transaction type (S1DM, SMIN, Z/Y..), you can set default values for the standard and custom fields and also influence their display settings (editability, visibility etc) in the dialog.
The custom fields can be added for a transaction using the AET tool.
Understanding the BAdI Interface
In the implementation method, /SALM/IF_TM_TWL_DEFECT_DEFAULT~GET_DEFAULT_VALUES, there are 3 importing parameters: tester root key (iv_tsta_root_key), test plan ID (iv_tpln_id) and test package ID (iv_tpck_id) and 2 changing parameters: ch_default_values, ch_default_settings.
These importing parameters can be used to get more information related to the test case, test package or test plan. For example, you can retrieve the test case classification and use that in the defaulted description for the defect. The BAdI also has an example implementation to understand how the values can be defaulted.
Using the changing parameter ch_default_values, you can default values for the following fields:
System ID and Client
Long Text / Description
Processor BP ID
Support Team BP ID
Custom Fields defined for the transaction
Custom Fields Field Control Property
Standard Fields Defaulting
For example, to default the values for component, system and client, the following code has been added inside the BAdI implementation.
The other changing parameter ch_default_settings can be used to decide the visibility, editability and mandatory properties of the standard fields.
After the dialog is rendered, system, client and component are pre-filled from the BAdI implementation. Component is also marked as a mandatory field.
Custom Field Defaulting
You can also default the custom fields property value too.
Let's assume, I have created custom field zzafld00000k (IT Comment) using AET for defect transaction type S1DM. Hence, it will be maintained in ch_default_values structure as well.
Using the same structure ch_default_values, you can also control the field control property of the custom fields. Field control property will have 4 options to select from for each custom field.
0 = Hidden
1 = Not Editable
3 = Optional
7 = Mandatory
If no defaulting is present in the BAdI for custom fields, the field control property values are taken from the SPRO configuration itself. Please refer to the customizing “Activate Custom Fields for Focused Build Document Types” for custom fields related customizing.
After the dialog is rendered, the custom field “IT Comment” is pre-filled and non-editable.
With this example, you can understand how the BAdI can be used to pre-fill the fields of the "Create Defect Dialog" and also control their display settings.
Please feel free to provide feedback either directly here in the comment section or in case of questions, you can submit them here. You are also encouraged to follow SAP Solution Manager tag here and Focused Build for SAP Solution Manager tag here.