Using PARAMETERS to display specific set of data.
To set the parameters/select options we can use two of the methods: CONDITION_FACTORY, SET_SELECT_OPTIONS of IF_SALV_GUI_TABLE_IDA
Use the CONDITION_FACTORY method to get the reference of IF_SALV_IDA_CONDITION_FACTORY
Then use EQUALS methods of the IF_SALV_IDA_CONDITION_FACTORY to set the parameters and which returns the reference of IF_SALV_IDA_CONDITION.
Then call the SET_SELECT_OPTIONS method and push back the reference of IF_SALV_IDA_CONDITION.
Also IF_SALV_IDA_CONDITION provides logical operation methods.
Program: Sets the fixed value for CARRID field as DL & LH with OR condition.
Ouput:
Program: Parameter user input.
PARAMETERS: p_carrid TYPE sflight–carrid.
DATA: lr_salv TYPE REF TO if_salv_gui_table_ida,
lr_cond_fact TYPE REF TO if_salv_ida_condition_factory,
lr_cond TYPE REF TO if_salv_ida_condition.
cl_salv_gui_table_ida=>create(
EXPORTING
iv_table_name = ‘SFLIGHT’
RECEIVING
ro_alv_gui_table_ida = lr_salv ).
* Instantiate Condition Factory
lr_cond_fact = lr_salv->condition_factory( ).
* Set the parameter value & get condition reference
lr_cond = lr_cond_fact->equals( name = ‘CARRID’ value = p_carrid ).
*Set the condition for data retrival
lr_salv->set_select_options(
EXPORTING
* it_ranges =
io_condition = lr_cond ).
* Display ALV
lr_salv->fullscreen( )->display( ).
Run with different inputs and see the result.
2 comments