How to set PARAMETERS to the ALV with IDA on HANA



Hello everyone, In our previous tutorial we introduced you to the new flavor of ABAP ALV called ALV with Integrated Date Access(ALV with IDA). In our previous tutorial we have retrieved the full data, but usually users want to restrict the data retrieved by using “Parameters” on selection screen of the report.In this tutorial, we will learn how to set parameters to the ALV with IDA. So lets get started.

To set the PARAMETERS to ALV with IDA

  • Get the reference object for the IDA condition factory IF_SALV_IDA_CONDITION_FACTORY  by calling the method CONDITION_FACTORY( ).
  • Build the conditions by using the method EQUALS( ).
  • Pass the above created conditions to the method SET_SELECT_OPTIONS of IDA class CL_SALV_GUI_TABLE_IDA.

1. Create an ABAP Program in Eclipse.Enter Name, Description and click on Next.

New ABAP Program

2. In the Selection of Transport Request window, choose the transport request. As we are saving the program in $TMP package in our case no transport request is required.Click on Finish.

Selection of Transport Request

3. Copy and paste the below code.


DATA: lo_additional_condition TYPE REF TO if_salv_ida_condition,
      lo_condition_factory    TYPE REF TO if_salv_ida_condition_factory.

*0... Declare PARAMETERS

*1... Declare SELECT-OPIONS

*2... Create object reference ALV with IDA
 DATA(lo_alv_display) = cl_salv_gui_table_ida=>create( iv_table_name    = 'SNWD_PD' ).

*3... Build range tables
DATA(lo_range_collector) = NEW cl_salv_range_tab_collector( ).

lo_range_collector->add_ranges_for_name( iv_name = 'PRODUCT_ID' 
                                         it_ranges = s_prdid[] ).
                     et_named_ranges = DATA(lt_select_options) ).

*4... Build conditions
 lo_condition_factory = lo_alv_display->condition_factory( ).
 lo_additional_condition = lo_condition_factory->equals( name = 'CATEGORY'
                                                         value = p_prdctg ).

*5... Set select options and conditions
lo_alv_display->set_select_options( it_ranges    = lt_select_options
                                    io_condition = lo_additional_condition ).

*5... Display ALV
 lo_alv_display->fullscreen( )->display( ).


4. Lets look at what have we written,

  1. Declared the select options for the field PRODUCT_ID and PARAMETERS for CATEGORY.
  2. Create and add the range table for the select options PRODUCT_ID.
  3. Get the ranges of select options into the table LT_SELECT_OPTIONS.
  4. Build the conditions for the  PARAMETERS on selection screen using condition factory classes.
  5. Finally set the select options and parameters to the ALV with IDA using SET_SELECT_OPTIONS.

5. Activate and execute the ABAP program.


6. Provide values for parameter product category selection screen and hit execute button.

Selection Screen

7. You should see the output for the selected product category only, like below.

Report Output

8. Now provide both Parameters and select-options on selection screen.Hit execute button

Selection Screen-1

Use Case 1 - Report OutputYou have successfully created an ABAP ALV with IDA using Parameters and Select- Options. Please stay tuned to us for ABAP on HANA and ABAP in Eclipse tutorials.Please feel free to comment and let us know your feedback. You feedback will keep us alive.

Thank you.

  • Ibrahim

    it is really nice,
    it means , I can just build my condtions, and I don’t care about the select, HANA takes over this step. It means high performance,

    another question, ´could you please provide us more information about it please,

    sun, avg, sort , etc
    thank you