(DV-2105) Filtering screen
The Set filters screen allows you to define filter values to be used during the DB table read. It supports 3 types of filtering options: Static filter, Dynamic filter, WHERE condition. It is allowed to use all the 3 types of filters for a single field, the relation between each filter is logical AND operation.
The Static filter supports a maximum of 100 distinct filtering fields. It is possible to swap between the descriptions of table filtering fields and their technical name by clicking on the 'Display Description/Technical Name' button.
The Dynamic filter allows the runtime execution of a piece of ABAP code which returns a table of selection ranges, which then are applied as filtering values during the DB read. This is an advanced feature, it is expected that the user has at least basic knowledge of the ABAP syntax and coding. Each field of a table can have a maximum of one Dynamic filter (DF) defined in a Variant.
To create a DF click on the append row button. First, fill in the Field name, then fill in the filter name. The ABAP code of a DF can be opened by double-clicking on the DF name. If the DF doesn't exist a pop-up will ask for confirmation to create the new DF. The DF naming is restricted to X/Y/Z prefix for the DFs created by the customer. The Local option in the filter row defines that if a Variant is run on a remote system through RFC, the ABAP code should be executed locally on the main system or remotely on the target system.
The ABAP editor allows the edition of a DF’s code.
The code's syntax can be checked with the Check syntax button.
The code can be pretty-printed by clicking on the Pretty print button.
By clicking on the Confirm button the DF’s code will be saved regardless of the validity of its syntax to allow continuous writing of a DF’s code.
By clicking on the Cancel button all the changes made for the code from the last Confirmation will be discarded. A Variant can be saved with a syntactically incorrect DF, at saving a warning pop-up will inform the user of the code's incorrectness.
The code of the DF’s report is locked, only a part of the get_filter form is editable, where the filters code should be written. The user can use the add_to_range macro to add a selection range to the returning table. From the report it is accessible the context of the current run through the lo_run_ctx object, this object carries the available information of the run (e.g. the timestamp of the last run of the variant).
Available information from the context class in current class
lo_run_ctx->A_VARIANT_ID - after image id
lo_run_ctx->INITIALIZED - is context class initialized
lo_run_ctx->LAST_START_TIMESTAMP - the timestamp of the last run
lo_run_ctx->PL_TECHNAME - testplan technical name
lo_run_ctx->RFC_DEST - RFC destination of the Variant
lo_run_ctx->RUNID - runID of the Variant execution
lo_run_ctx->START_TIMESTAMP - timestamp of the start of the run
lo_run_ctx->TC_TECHNAME - testcase technical name
lo_run_ctx->TC_TYPE - testcase type
lo_run_ctx->VARIANT_ID - VariantID
lo_run_ctx->TABLE_NAME - tablename for the Variant (30c)
lo_run_ctx->ROWCOUNT - is rowcount selected
lo_run_ctx->STORAGE_ID - StorageID for SM Table Variant
lo_run_ctx->T_FIELD_MAPPING - table of Field Mapping definition
lo_run_ctx->T_CHAR_FIELD - table of selected key(charachteristic) fields of the Variant
lo_run_ctx->T_KYF_FIELD - table of selected value fields of the Variant
lo_run_ctx->T_TAGS - table with Variant TAGs
lo_run_ctx->EXT_TABNAME_LONG - external table name for SM Table Variants (255c)
lo_run_ctx->T_DYN_FLT - table with Dynamic Filters of the Variant
lo_run_ctx->T_CONTENT - table of DF ABAP codes
Example for adding values to range:
add_to_range:
'I' 'EQ' 'Any low value' 'Any high value',
'E' 'GT' 'Any low value' 'Any high value'.