Select Options use in ALV Report in ABAP Webdynpro

Hello Experts,
I Already Done ALV Report In webdynpro with use of view Container UI element.But i do not know ALV  report with help of select option.so
Kindly Give Me simple Example of Use in select Option In ALV.
Reply ASAP.
Regards,
Ameya Karadkhedkar

First you need to add the component WDR_SELECT_OPTIONS to the tab "Used components" of your Web Dynpro component and then also in the properties tab of your view. In the layout you need to create another view container and embed the view WND_SELECTION_SCREEN of the new used component to it.
Then in the WDDOINIT method of your view you can write this code (where SEL_OPT is the given name for the used component) in order to set the select option (This example is a select option for a date):
DATA: lo_cmp_usage           TYPE REF TO if_wd_component_usage,
      lo_interfacecontroller TYPE REF TO iwci_wdr_select_options,
      lo_r_helper_class      TYPE REF TO if_wd_select_options,
      rt_range_date          TYPE REF TO data.
* Instantiate used component WDR_SELECT_OPTIONS (SEL_OPT)
lo_cmp_usage = wd_this->wd_cpuse_sel_opt( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
  lo_cmp_usage->create_component( ).
ENDIF.
* Call method in used controller
lo_interfacecontroller = wd_this->wd_cpifc_sel_opt( ).
lo_r_helper_class = lo_interfacecontroller->init_selection_screen( ).
* Create select option for the date
CALL METHOD lo_r_helper_class->create_range_table
  EXPORTING
    i_typename    = 'DATS'
  RECEIVING
    rt_range_table = rt_range_date.
CALL METHOD lo_r_helper_class->add_selection_field
  EXPORTING
    i_id          = 'DATS'
    it_result     = rt_range_date
    i_read_only   = ABAP_FALSE.
* Hide unnecessary buttons
CALL METHOD lo_r_helper_class->set_global_options
  EXPORTING
    i_display_btn_cancel  = abap_false
    i_display_btn_check   = abap_false
    i_display_btn_reset   = abap_false
    i_display_btn_execute = abap_false.
Finally you need to write the following code in the action of the button in order to fetch the range table selected by the user.
DATA: lo_cmp_usage            TYPE REF TO if_wd_component_usage,
      lo_interfacecontroller  TYPE REF TO iwci_wdr_select_options,
      lo_r_helper_class       TYPE REF TO if_wd_select_options,
      rt_date                 TYPE REF TO data.
FIELD-SYMBOLS: <fs_date> TYPE table.
* Instantiate used component WDR_SELECT_OPTIONS (SEL_OPT)
lo_cmp_usage = wd_this->wd_cpuse_sel_opt( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
  lo_cmp_usage->create_component( ).
ENDIF.
* Call method in used controller
lo_interfacecontroller = wd_this->wd_cpifc_sel_opt( ).
lo_r_helper_class = lo_interfacecontroller->init_selection_screen( ).
* get selected range of inspections date
CALL METHOD lo_r_helper_class->get_range_table_of_sel_field
  EXPORTING
    i_id          = 'DATS'
  RECEIVING
    rt_range_table = rt_date.
ASSIGN rt_date->* TO <fs_date>.
Then you can use the value that is assigned to the field symbol <fs_date> to continue with your ALV.

Similar Messages

  • How to use selection buttons in an ALV created without abap objects?

    Hi, I use an alv created without ABAP Objects to show some information. Can I introduce inside the alv, the top buttons to select all rows / none row? And the second question, how may I introduce lateral buttons in the ALV to select indidividual rows?
    Thanks!

    HI
    i think you use REUSE_ALV_LIST_DISPLAY or REUSE_ALV_GRID_DISPLAY FMs.
    Try to calling the function in this way
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
    *      I_INTERFACE_CHECK              = ' '
    *      I_BYPASSING_BUFFER             =
    *      I_BUFFER_ACTIVE                = ' '
           i_callback_program             = 'YOURREPORT'
           i_callback_pf_status_set       = 'SET_PF_STATUS'
           i_callback_user_command        = 'USER_COMAND'
    *      I_STRUCTURE_NAME               =
           is_layout                      =  ls_layout
           it_fieldcat                    =  fieldcat
    *      IT_EXCLUDING                   =
    *      IT_SPECIAL_GROUPS              =
    *      IT_SORT                        =
    *      IT_FILTER                      =
    *      IS_SEL_HIDE                    =
    *      I_DEFAULT                      = 'X'
           i_save                         = 'A'
          is_variant                     = gt_variant
          it_events                      = event_tab
    *      IT_EVENT_EXIT                  =
    *      IS_PRINT                       =
    *      IS_REPREP_ID                   =
    *      I_SCREEN_START_COLUMN          = 0
    *      I_SCREEN_START_LINE            = 0
    *      I_SCREEN_END_COLUMN            = 0
    *      I_SCREEN_END_LINE              = 0
    *    IMPORTING
    *      E_EXIT_CAUSED_BY_CALLER        =
    *      ES_EXIT_CAUSED_BY_USER         =
           TABLES
             t_outtab                     = tb_output
          EXCEPTIONS
            program_error                  = 1
            OTHERS                         = 2.
    ENDFORM.                    " LISTA
    where
    'SET_PF_STATUS'
    'USER_COMAND'
    are two form like this.
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTANDARD'. " EXCLUDING rt_extab.
    ENDFORM.                               " SET_PF_STATUS
    FORM user_comand USING r_ucomm     LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&CPR'.
        WHEN 'YOUR CODE FUNCTION'
    endcase.
    I hope it can help you.
    Bye
    enzo

  • What are main events in that are used in ALV reports

    hi gurus
    what are main events in that are used in ALV reports....
    regards
    baskar

    hi
    i think this will help u.
    Events in alv and their FM    The main events in alv and their FM and why we use these: 
    1. SLIS_PRINT_ALV. 
    2. SLIS_T_LISTHEADER. 
    3. SLIS_T_EVENT. 
    4. SLIS_T_SORTINFO_ALV. 
    5. SLIS_T_LAYOUT_ALV. 
    6. SLIS_T_FIELDCAT_ALV. 
    and in classic reports what is the sequence of events:   === Events are 
    At selection-screen output. 
    Initialization. 
    At selection-screen on field 
    At selection-screen on end of field 
    At selection-screen on Radiobutton Group R1. (If you have any radio buttons) 
    At selection-screen on block b1. (If you have any blocks) 
    Start-of-selection. 
    Get node. (if the data is retreived from a logical database) 
    Get node late. (if the data is retreived from a logical database) 
    Top-of-page. (if the write statement is in the end-of-selection event or we can say that before the first write statement) 
    end-of-selection. 
    and fuction modules are 
    LISTHEADER - Is used to print the header information in the ALV List. Name, Date, Time, ALV Name and other details are called as Header information.   EVENT - Basically this is the FM to handle Event's. When the user needs to do some event operation like when double clicking the a particular field we need to perform some operation.   These events are captured by this FM.   LAYOUT - This FM is used to define the layout of the List. There are many options available in this FM to define the Layout style.   FIELDCAT - These are used to populate the List header. We can change them according to our req. 
    User-defined Text Output Event
        Application
          print_end_of_list
        Define output text to be printed at the end of the entire list
          print_top_of_list
        Define output text to be printed at the beginning of the entire list
          print_end_of_page
        Define output text to be printed at the end of each page
          print_top_of_page
        Define output text to be printed at the beginning of each page
          subtotal_text
        Define self-defined subtotals texts
    Mouse-controlled Actions in the Grid Control Event
        Application
          button_click
        Query a click on a pushbutton in the ALV Grid Control
          double_click
        Query a double-click on a cell of the ALV Grid control 
          hotspot_click
        Query a hotspot click on columns defined for this purpose in advance
          onDrag
        Collect information when elements of the ALV Grid Control are dragged 
          onDrop
        Process information when elements of the ALV Grid Control are dropped 
          onDropComplete
        Perform final actions after successful Drag&Drop 
          onDropGetFlavor
        Distinguish between options for Drag&Drop behavior
    Processing of Self-defined and Standard Functions Event
        Application
          before_user_command
        Query self-defined and standard function codes
          user_command
        Query self-defined function codes
          after_user_command
        Query self-defined and standard function codes
    Definition of Self-defined Functions Event
        Application
          toolbar
        Change, delete or add GUI elements in the toolbar
          menu_button
        Define menus for menu buttons in the toolbar
          context_menu_request
        Change context menu
          onf1
        Define self-defined F1 help
    All of these can be found under type group SLIS.
    Events
    SLIS_EV_ITEM_DATA_EXPAND        TYPE SLIS_FORMNAME VALUE 'ITEM_DATA_EXPAND',
    SLIS_EV_REPREP_SEL_MODIFY       TYPE SLIS_FORMNAME VALUE 'REPREP_SEL_MODIFY', SLIS_EV_CALLER_EXIT_AT_START TYPE SLIS_FORMNAME VALUE 'CALLER_EXIT',
    SLIS_EV_USER_COMMAND              TYPE SLIS_FORMNAME VALUE 'USER_COMMAND',
    SLIS_EV_TOP_OF_PAGE                     TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
    SLIS_EV_DATA_CHANGED                TYPE SLIS_FORMNAME VALUE 'DATA_CHANGED',
    SLIS_EV_TOP_OF_COVERPAGE       TYPE SLIS_FORMNAME VALUE 'TOP_OF_COVERPAGE',
    SLIS_EV_END_OF_COVERPAGE       TYPE SLIS_FORMNAME VALUE 'END_OF_COVERPAGE',
    SLIS_EV_FOREIGN_TOP_OF_PAGE TYPE SLIS_FORMNAME
    VALUE 'FOREIGN_TOP_OF_PAGE', SLIS_EV_FOREIGN_END_OF_PAGE TYPE SLIS_FORMNAME
    VALUE 'FOREIGN_END_OF_PAGE',
    SLIS_EV_PF_STATUS_SET                  TYPE SLIS_FORMNAME VALUE 'PF_STATUS_SET',
    SLIS_EV_LIST_MODIFY                      TYPE SLIS_FORMNAME VALUE 'LIST_MODIFY',
    SLIS_EV_TOP_OF_LIST                       TYPE SLIS_FORMNAME VALUE 'TOP_OF_LIST',
    SLIS_EV_END_OF_PAGE                    TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE',
    SLIS_EV_END_OF_LIST                      TYPE SLIS_FORMNAME VALUE 'END_OF_LIST',
    SLIS_EV_AFTER_LINE_OUTPUT       TYPE SLIS_FORMNAME VALUE 'AFTER_LINE_OUTPUT', SLIS_EV_BEFORE_LINE_OUTPUT     TYPE SLIS_FORMNAME VALUE 'BEFORE_LINE_OUTPUT',
    SLIS_EV_SUBTOTAL_TEXT                TYPE SLIS_FORMNAME VALUE 'SUBTOTAL_TEXT'.
    with regards
    sravani
    award points if found useful.

  • How to select multiple row in ALV report

    Hi friends,
    1. How to select multiple row in ALV report
                   ( How to set tab in ALV report and want to select multiple line.)
    Thanking you.
    Subash

    Hi Sahoo,
    If you are using the class CL_GUI_ALV_GRID. In methods SET_TABLE_FOR_FIRST_DISPLAY.
    in layout structure you will find field SEL_MODE
    pass :
    LS_LAYOUT-SEL_MODE = 'A'.
    In PAI.
      CALL METHOD GRID->GET_SELECTED_ROWS
        IMPORTING
          ET_INDEX_ROWS = T_ROWS
          ET_ROW_NO     = T_ROWID.
    Hope these will solve your problem.
    Regards,
    Kumar M.

  • Print Selection Screen Parameters in ALV report only once

    Does anyone know how to print the selection screen within a ALV report.
    I've tried everything. I have the code to capture the selection parameters into a internal table. I can use top_of_page but I only want it printed once.

    Hi,
      If you have captured the selection screen entries in an internal table, then you could display it once by using the BLOCK LIST ALV.
    Check the function module.
    REUSE_ALV_BLOCK_LIST_DISPLAY
    Using this function module more than 1 alv could be display in the report.
    In our case ..there will be two alvs ...one for the selection screen n other for the main report output.
    Check the following example on the block List ALV....
    <b>BALVBT01</b>.
    Regards,
    Vara

  • Dynamic select-options using parameter

    Hi experts,
    It the user selects one value from dropdown list, it should generate one select-option using that name. Is it possible?
    for example, (pls see my code).
    If user selects 'Malek' from parameter, <b>and press 'ENTER'</b>
    <b>select-option should display with that name</b> like
    Malek      malek-low  malek-high
    And if user selects some other like 'Amran'. It should generate(and append)
    Malek      malek-low  malek-high
    amran      amran-low amran-high
    and so on....
    report c.
    data: t_return like ddshretval occurs 0 with header line.
    data: begin of t_names occurs 0,
           name like usr01-bname,
          end of t_names.
    parameters : i_inspec like usr01-bname.
    at selection-screen on value-request for i_inspec.
      perform get_names.
    form get_names.
      t_names-name = 'Malek'.
      append t_names.
      t_names-name = 'Amran'.
      append t_names.
      t_names-name = 'Ow CC'.
      append t_names.
      t_names-name = 'titbit'.
      append t_names.
      call function 'F4IF_INT_TABLE_VALUE_REQUEST'
        exporting
          retfield    = 'T_NAMES-NAME'
          dynpprog    = sy-cprog
          dynpnr      = sy-dynnr
          dynprofield = 'I_INSPEC'
          value_org   = 'S'
        tables
          value_tab   = t_names.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno with
        sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
      read table t_return index   1.
    endform.                    "GET_NAMES
    Reward guaranteed,
    thanks
    kaki

    Use At selection-screen output,use screen internal table..
    User Dynamic Selection
    at selection-screen output.
      select single * from t000md.
      loop at screen.
        case screen-group1.
          when 'REL'.
            if not  p_old is initial.
              screen-input = '0'.
              screen-required = '0'.
              screen-invisible = '1'.
            endif.
            modify screen.
          when 'BEL'.
            if not p_new is initial.
              screen-input = '0'.
              screen-required = '0'.
              screen-invisible = '1'.
            endif.
            modify screen.
          when 'ARB'.
            if  p_new is initial.
              screen-input = '0'.
              screen-required = '0'.
              screen-invisible = '1'.
            endif.
            modify screen.
          when 'MTA'.
            if  p_new is initial.
              screen-input = '0'.
              screen-required = '0'.
              screen-invisible = '1'.
            endif.
            modify screen.
        endcase.
      endloop.

  • Edit a selected row in an alv report after pressing a push button ?

    hi all ,
    I want to edit a selected row in an alv report but that too after i press a push button . After pressing the push button , a pop up shud *** showing all the entries of the selected row which shud be editable and after editing it shud be saved into the database table.
    How can i do this please help asap ???

    May this prog. of mine can solve your requirement.
    REPORT z_demo_alv_jg.
    TYPE-POOLS                                                          *
    TYPE-POOLS: slis.
    INTERNAL TABLES/WORK AREAS/VARIABLES                                *
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
          i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
          w_field TYPE slis_fieldcat_alv,
          p_table LIKE dd02l-tabname,
          dy_table TYPE REF TO data,
          dy_tab TYPE REF TO data,
          dy_line TYPE REF TO data.
    FIELD-SYMBOLS                                                       *
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                   <dyn_wa> TYPE ANY,
                   <dyn_field> TYPE ANY,
                   <dyn_tab_temp> TYPE STANDARD TABLE.
    SELECTION SCREEN                                                    *
    PARAMETERS: tabname(30) TYPE c,
                lines(5)  TYPE n.
    START-OF-SELECTION                                                  *
    START-OF-SELECTION.
    Storing table name
      p_table = tabname.
    Create internal table dynamically with the stucture of table name
    entered in the selection screen
      CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
      ASSIGN dy_table->* TO <dyn_table>.
      IF sy-subrc <> 0.
        MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.
        LEAVE TO LIST-PROCESSING.
      ENDIF.
    Create workarea for the table
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.
    Create another temp. table
      CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN dy_tab->* TO <dyn_tab_temp>.
      SORT i_fieldcat BY col_pos.
    Select data from table
      SELECT * FROM (p_table)
      INTO TABLE <dyn_table>
      UP TO lines ROWS.
      REFRESH <dyn_tab_temp>.
    Display report
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_structure_name         = p_table
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_pf_status_set = 'SET_PF_STATUS'
        TABLES
          t_outtab                 = <dyn_table>
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
      ENDIF.
    *&      Form  SET_PF_STATUS
          Setting custom PF-Status
         -->RT_EXTAB   Excluding table
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'Z_STANDARD'.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  user_command
          Handling custom function codes
         -->R_UCOMM      Function code value
         -->RS_SELFIELD  Info. of cursor position in ALV
    FORM user_command  USING    r_ucomm LIKE sy-ucomm
                               rs_selfield TYPE slis_selfield.
    Local data declaration
      DATA: li_tab TYPE REF TO data,
            l_line TYPE REF TO data.
    Local field-symbols
      FIELD-SYMBOLS:<l_tab> TYPE table,
                    <l_wa>  TYPE ANY.
    Create table
      CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN li_tab->* TO <l_tab>.
    Create workarea
      CREATE DATA l_line LIKE LINE OF <l_tab>.
      ASSIGN l_line->* TO <l_wa>.
      CASE r_ucomm.
      When a record is selected
        WHEN '&IC1'.
        Read the selected record
          READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
          rs_selfield-tabindex.
          IF sy-subrc = 0.
          Store the record in an internal table
            APPEND <dyn_wa> TO <l_tab>.
          Fetch the field catalog info
            CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
              EXPORTING
                i_program_name         = 'Z_DEMO_PDF_JG'
                i_structure_name       = p_table
              CHANGING
                ct_fieldcat            = i_fieldcat
              EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
            IF sy-subrc = 0.
            Make all the fields input enabled except key fields
              w_field-input = 'X'.
              MODIFY i_fieldcat FROM w_field TRANSPORTING input
              WHERE key IS INITIAL.
            ENDIF.
          Display the record for editing purpose
            CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
              EXPORTING
                i_callback_program    = sy-repid
                i_structure_name      = p_table
                it_fieldcat           = i_fieldcat
                i_screen_start_column = 10
                i_screen_start_line   = 15
                i_screen_end_column   = 200
                i_screen_end_line     = 20
              TABLES
                t_outtab              = <l_tab>
              EXCEPTIONS
                program_error         = 1
                OTHERS                = 2.
            IF sy-subrc = 0.
            Read the modified data
              READ TABLE <l_tab> INDEX 1 INTO <l_wa>.
            If the record is changed then track its index no.
            and populate it in an internal table for future
            action
              IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
                <dyn_wa> = <l_wa>.
                i_index = rs_selfield-tabindex.
                APPEND i_index.
              ENDIF.
            ENDIF.
          ENDIF.
      When save button is pressed
        WHEN 'SAVE'.
        Sort the index table
          SORT i_index.
        Delete all duplicate records
          DELETE ADJACENT DUPLICATES FROM i_index.
          LOOP AT i_index.
          Find out the changes in the internal table
          and populate these changes in another internal table
            READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
            IF sy-subrc = 0.
              APPEND <dyn_wa> TO <dyn_tab_temp>.
            ENDIF.
          ENDLOOP.
        Lock the table
          CALL FUNCTION 'ENQUEUE_E_TABLE'
            EXPORTING
              mode_rstable   = 'E'
              tabname        = p_table
            EXCEPTIONS
              foreign_lock   = 1
              system_failure = 2
              OTHERS         = 3.
          IF sy-subrc = 0.
          Modify the database table with these changes
            MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
            REFRESH <dyn_tab_temp>.
          Unlock the table
            CALL FUNCTION 'DEQUEUE_E_TABLE'
              EXPORTING
                mode_rstable = 'E'
                tabname      = p_table.
          ENDIF.
      ENDCASE.
      rs_selfield-refresh = 'X'.
    ENDFORM.                    "user_command
    Regards,
    Joy.

  • How many lines we can print using Non-alv report list ?

    Hi Experts,
    How many lines we can print using Non-alv report list ?
    regards
    vishnu

    Hi,
    It depends on the page size according to the page size we can set the no. of lines as follows,
    REPORT  program_name   NO STANDARD PAGE HEADING
    LINE-SIZE 290
    LINE-COUNT 65.
    Hope it helps you,
    Regards,
    Abhijit G. Borkar

  • How to apply List box for multiple selection of rows  in ALV report ?

    Hi Exprots,
    1: How to apply List box for multiple selection of rows  in ALV report ?
    Thanking you.
    Subash

    hi,
    check the below program.
    REPORT zalv_dropdowns.
    *Type pools declarations for ALV
    TYPE-POOLS : slis.
    *data declarations for ALV container,ALV grid, Fieldcatalogues & layout
    DATA: g_grid  TYPE REF TO cl_gui_alv_grid,
          g_custom_container TYPE REF TO cl_gui_custom_container,
          gt_fieldcat TYPE lvc_t_fcat,
          gs_layout TYPE lvc_s_layo.*INTERNAL TABLE AND WA DECLARATIONS FOR t517 A table
    DATA: gt_outtab TYPE STANDARD TABLE OF t517a INITIAL SIZE 0,
          wa_outtab TYPE t517a.
    START-OF-SELECTION.*Call to ALV
      CALL SCREEN 600.*On this statement double click  it takes you to the screen painter SE51.
    *Create a Custom container and name it CCONT and OK code as OK_CODE.
    *Save check and Activate the screen painter.
    *Now a normal screen with number 600 is created which holds the ALV grid.
    PBO of the actual screen , Here we can give a title and customized menus
    Here we also call the subroutine for ALV output.
          MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      PERFORM alv_output.
    ENDMODULE.                    "pbo OUTPUT
          MODULE PAI INPUT                                              *
    MODULE pai INPUT.
    ENDMODULE.                    "pai INPUT
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat.
    DATA ls_fcat TYPE lvc_s_fcat.
    *Build the field catalogue
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'T517A'
        CHANGING
          ct_fieldcat      = gt_fieldcat.
    To assign dropdown in the fieldcataogue
      LOOP AT gt_fieldcat INTO ls_fcat.   
    CASE ls_fcat-fieldname.
       WHEN 'SLART'.
    *is the first list box
            ls_fcat-drdn_hndl = '1'.
            ls_fcat-outputlen = 15.
            MODIFY gt_fieldcat FROM ls_fcat.
    is the second list box    
    WHEN 'ABART'.       
            ls_fcat-drdn_hndl = '2'.
            ls_fcat-outputlen = 15.
            MODIFY gt_fieldcat FROM ls_fcat.   
    ENDCASE.
      ENDLOOP.
    ENDFORM.                    "build_fieldcat
    *&      Form  ALV_OUTPUT
    FORM alv_output .*Create object for container
      CREATE OBJECT g_custom_container
             EXPORTING container_name = 'CCONT'.
    *create object for grid
      CREATE OBJECT g_grid
             EXPORTING i_parent = g_custom_container.
    Build fieldcat and set column
    *Assign a handle for the dropdown listbox.
      PERFORM build_fieldcat.
    *Build layout
      PERFORM build_layout.
    Define a drop down table.
      PERFORM dropdown_table.
    *fetch values from the T517A table
      SELECT * FROM t517a INTO TABLE gt_outtab.
    *Display ALV output
      CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
          is_layout       = gs_layout
        CHANGING
          it_fieldcatalog = gt_fieldcat
          it_outtab       = gt_outtab.ENDFORM.                               "ALV_OUTPUT
    *&      Form  dropdown_table
          text
    -->  p1        text
    <--  p2        text
    FORM dropdown_table.*Declarations for drop down lists in ALV.
      DATA: lt_dropdown TYPE lvc_t_drop,
            ls_dropdown TYPE lvc_s_drop.
    First SLART listbox (handle '1').
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '01 Primary school'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '1'.
      ls_dropdown-value = '02 Lower Secondary'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '1'.
      ls_dropdown-value = '03 Upper Secondary'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '04 Professional School'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '05 College'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '06 University'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = '09 Other Establishment'.
      APPEND ls_dropdown TO lt_dropdown.* Second ABART listbox (handle '2').  ls_dropdown-handle = '2'.
      ls_dropdown-value = '10 Primary School certificate'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '2'.
      ls_dropdown-value = '20 Lower secondary/Junior high'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '30 High school diploma(B-levels)'.
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '2'.
      ls_dropdown-value = '31 Vocational'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '32 Matriculation'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '40 Specialist vocational certificate'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '50 College degree Level1'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '51 College degree Level2'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '52 Masters degree'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '60 Univ Degree level1'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '61 Bachelors degree'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '62 Masters degree'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '63 Licenciate'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '64 Doctors Degree Ph.D'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '89 None'.
      APPEND ls_dropdown TO lt_dropdown.  ls_dropdown-handle = '2'.
      ls_dropdown-value = '90 Unknown'.
      APPEND ls_dropdown TO lt_dropdown.*method to display the dropdown in ALV
      CALL METHOD g_grid->set_drop_down_table
        EXPORTING
          it_drop_down = lt_dropdown.ENDFORM.                               " dropdown_table
    *&      Form  build_layout
          text
    *layout for ALV output
    FORM build_layout .  gs_layout-cwidth_opt = 'X'.
      gs_layout-grid_title = 'ALV DROPDOWN LISTS'.
      gs_layout-no_toolbar = 'X'.ENDFORM.                    " build_layout
    endform.
    Edited by: S.r.v.r.Kumar on Jun 1, 2009 2:48 PM

  • Displaying selection screen details in Alv Report  output display as Header

    Hi all,
    May be somebody knows how I can show selected values with select-options in top_of_page using REUSE_ALV_GRID_DISPLAY.
    This shoud work for all the reports and diff selection screens .
    I need one dynamic process which will for display any report selection screen selected details.(Basically varient information of report).
    Small example if possible, please.
    Thanks in advance,
    Rimas

    Hi Thiru,
    Thanks for the input.
    This is my exact requirement.
    Hi Experts,
    I would like to Display / Print  Select-options selected details in ALV Header.
    Ex: Say suppose here i enter kunnr as 1000
                                            lifnr as    2000 to 4000
                                            p_langu as  'EN'.
                                           p_dir  as 'C:\TEMP,
                                           p_upda as 'X'
    for selection screen below.                    
    SELECTION-SCREEN :BEGIN OF BLOCK blk1 WITH FRAME TITLE text-000.
    SELECT-OPTIONS : s_kunnr FOR kna1-kunnr.
    SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr.
    PARAMETER      : p_lanuge LIKE t002-spras DEFAULT sy-langu.
    PARAMETER: p_dir  LIKE rlgrap-filename
               DEFAULT text-003 LOWER CASE.
    PARAMETERS: p_upd AS CHECKBOX DEFAULT 'X'.
    I dont want to Hard code selection screen values like
    DATA: header TYPE slis_t_listheader,
    wa TYPE slis_listheader,
    wa-typ = 'S'(093).
      wa-key = s_lifnr .
      wa-info = 'Vendor no".
      APPEND wa TO header.
    I want dynamic process for all of my selection screen values selected
    hard code may be it will be fine small selection screen it will work.
    Fur that i got one process to get dynamically through fm
    Ex: DATA: irsparams TYPE rsparams OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
    EXPORTING
    curr_report = program
    TABLES
    selection_table = irsparams
    EXCEPTIONS
    not_found = 1
    no_report = 2
    OTHERS = 3.
    loop at irsparams.
    write : / irsparams-SELNAME.
    write : / irsparams-SIGN.
    write : / irsparams-OPTION.
    write : / irsparams-LOW.
    write : / irsparams-HIGH.
    endloop.
    I have done my requirement partially but i am failed to achive my full  requirement.
    Because
    rsparams  strcture is diff from  slis_t_listheader.
    Can any one help me for further assistence to display irsparams strcture data in alv header.
    Thanks
    Nag

  • Excel option problem in ALV report output.

    Hi,
    In the output of the ALV report, if I click the Microsoft excel button, the following error is occured.
    "View cannot be switched: Product is not installed or integration is not active".
    We are using SAP GUI 7 and patch level 12.
    Please advice what shall be done to overcome this.

    Hi
    Try this.....
    Open Excel, go to Tool->Macros-->Security
    And you will see a window, Make sure that the two options at the bottom of the window are checked. Save all, close window and try again.
    And when excel asks about enable or not macros always select enable macros.
    Hope this helps.....

  • How to display selected table fields in ALV report.

    Hi,
    I am displaying data from table EKPO using ALV through this query.
    select * from ekpo into table itab_ekpo up to 25 rows.
    bt if i need to display selected fields like
    select ebeln matnr netpr from ekpo into table itab_ekpo up to 25 rows.
    IT gives  error GETWA_NOT_ASSIGNED.
    FIELD SYMBOL HAS NOT YET BEEN ASSIGNED
    CAN ANYONE PLZ HELP ME.

    Hi ,
          I am pasting the code in which i am getting the error.Plz help.
    REPORT  ZHALV.
    tables:ekpo.
    data itab_ekpo type ekpo occurs 100 with header line.
    types: begin of itab_new,
           f_ebeln type ekpo-ebeln,
           f_matnr type ekpo-matnr,
           f_netpr type ekpo-netpr,
           end of itab_new.
    data itab1 TYPE STANDARD TABLE OF itab_new initial size 0.
    type-pools: slis.
    DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
          lf_fieldcat TYPE slis_fieldcat_alv.
    DATA:    ws_repid TYPE sy-repid VALUE 'ZHALV'.
    DATA:  l_layout   TYPE slis_layout_alv.
    selection-screen Begin of block block1 with frame title text-111.
    select-options : S_EBELN for EKPO-EBELN.
    selection-screen end of block block1.
    INITIALIZATION.
    start-of-selection.
      select ebeln matnr netpr from ekpo into table itab1 up to 10 rows WHERE EBELN IN S_EBELN.
    *select * from ekpo into table itab_ekpo up to 25 rows.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM GET_DETAILS.
    end-of-selection.
    *&      Form  build_fieldcatalog
          text
    FORM build_fieldcatalog .
    PURCHASING DOCUMENT NUMBER
      CLEAR lf_fieldcat.
      lf_fieldcat-fieldname = 'EBELN'.
      lf_fieldcat-ref_tabname = 'EKKO'.
      lf_fieldcat-ref_fieldname = 'EBELN'.
    MATERIAL NUMBER
      CLEAR lf_fieldcat.
      lf_fieldcat-fieldname = 'MATNR'.
      lf_fieldcat-ref_tabname = 'EKPO'.
      lf_fieldcat-ref_fieldname = 'MATNR'.
      APPEND lf_fieldcat TO lt_fieldcat.
    NET PRICE IN PURCHASING DOCUMENT
      CLEAR lf_fieldcat.
      lf_fieldcat-fieldname = 'NETPR'.
      lf_fieldcat-ref_tabname = 'EKPO'.
      lf_fieldcat-ref_fieldname = 'NETPR'.
      lf_fieldcat-cfieldname = 'WAERS'.
      lf_fieldcat-do_sum = 'X'.
      APPEND lf_fieldcat TO lt_fieldcat.
    ENDFORM.                    " build_fieldcatalog
    *&      Form  GET_DETAILS
          text
    FORM GET_DETAILS.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
                                 I_INTERFACE_CHECK                 = ' '
                                 I_BYPASSING_BUFFER                = ' '
                                 I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                = ws_repid
                                 I_CALLBACK_PF_STATUS_SET          = ' '
                                 I_CALLBACK_USER_COMMAND           = ' '
                                 I_CALLBACK_TOP_OF_PAGE            = ' '
                                 I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
                                 I_CALLBACK_HTML_END_OF_LIST       = ' '
         I_STRUCTURE_NAME                  = 'EKPO'
                                 I_BACKGROUND_ID                   = ' '
                                 I_GRID_TITLE                      =
                                 I_GRID_SETTINGS                   =
                                 IS_LAYOUT                         =
                                  IT_FIELDCAT                       = lt_fieldcat
                                 IT_EXCLUDING                      =
                                 IT_SPECIAL_GROUPS                 =
                                 IT_SORT                           =
                                 IT_FILTER                         =
                                 IS_SEL_HIDE                       =
        I_DEFAULT                         = 'X'
        I_SAVE                            = 'A'
                                 IS_VARIANT                        =
                                 IT_EVENTS                         =
                                 IT_EVENT_EXIT                     =
                                 IS_PRINT                          =
                                 IS_REPREP_ID                      =
                                 I_SCREEN_START_COLUMN             = 0
                                 I_SCREEN_START_LINE               = 0
                                 I_SCREEN_END_COLUMN               = 0
                                 I_SCREEN_END_LINE                 = 0
                                 I_HTML_HEIGHT_TOP                 = 0
                                 I_HTML_HEIGHT_END                 = 0
                                 IT_ALV_GRAPHICS                   =
                                 IT_HYPERLINK                      =
                                 IT_ADD_FIELDCAT                   =
                                 IT_EXCEPT_QINFO                   =
                                 IR_SALV_FULLSCREEN_ADAPTER        =
                               IMPORTING
                                 E_EXIT_CAUSED_BY_CALLER           =
                                 ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = itab1
          EXCEPTIONS
                                 PROGRAM_ERROR                     = 1
                                OTHERS                            = 2.
      IF SY-SUBRC <> 0.
        WRITE: 'SY-SUBRC: ', SY-SUBRC .
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *append itab_ekpo to i_tab.
    ENDFORM.                    "GET_DETAILS

  • Regarding ALV Reporting in ABAP

    Hi All,
    I have some clarifications related to <b>ALV Reporting</b> in ABAP.
    <b>Actually i have to create ALV report with Structure Length/Each record length is around 300 characters.</b>
    Is it possible to create a ALV Report with <b>300</b> length for each record!
    If possible which is the best<b>[ALV]</b> method for the same!
    Can anybody give me the solution!
    Thanks in advance.
    Thanks & Regards,
    Prasad.

    Hai Prasad
    Check with the code
    *& Report  ZALV_PRAKASH_SAMP                                           *
    REPORT  ZALV_PRAKASH_SAMP .
    TABLES: MARA.
    TYPE-POOLS : SLIS.
    Data declaration
    DATA: BEGIN OF I_MARA OCCURS 0.
            INCLUDE STRUCTURE MARA.
    DATA: END OF I_MARA.
    DATA: V_REPID LIKE SY-REPID.
    selection-screen
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
      SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
      PARAMETERS: P_MTART LIKE MARA-MTART DEFAULT 'ROH'.
    SELECTION-SCREEN END OF BLOCK B1.
    initialisation
    INITIALIZATION.
    S_MATNR-LOW = '1400'.
    S_MATNR-HIGH = '1500'.
    APPEND S_MATNR.
    V_REPID = SY-REPID.
    start-of-selection
    START-OF-SELECTION.
    SELECT * FROM MARA
        INTO TABLE I_MARA
        WHERE MATNR IN S_MATNR AND
              MTART = P_MTART.
      CHECK SY-SUBRC = 0.
    end of selection
    END-OF-SELECTION.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
      I_CALLBACK_PROGRAM             = ' '
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
       I_STRUCTURE_NAME               = 'MARA'
      IS_LAYOUT                      =
      IT_FIELDCAT                    =
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
      TABLES
        T_OUTTAB                       = I_MARA
    EXCEPTIONS
      PROGRAM_ERROR                  = 1
      OTHERS                         = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    loop at i_mara.
    write:/ i_mara.
    endloop.
    Thanks & Regards
    Sreenivasulu P

  • How to make optional fields in alv report

    Hello Experts,
                             Can anyone tell me how to do fields as optional in ALV report Output. My requirement is I want to display only few fields as default in my output and remaining fields will be added if needed by clicking the layout button.For clear example i have totally 10 fields in that fields i want to display only 5 fields and remaining 5 fields will be optional and when i click on layout button then i can add those 5 fields also. Can anyone tell me how to do this.
    Thanks,
    Vinod.

    Hi Vinod,
    As suggested by Eitan, kindly use the attribute NO_OUT = 'X' in field catalog for the appropriate column.  Based on that we can hide the fields.
         L_FIELDCAT-NO_OUT = 'X'.
    Also we can group the hidden fields in layout using SP_GROUP attribute in Field catalog as shown below. Based on that, we can separate the fields based on category/group.
         L_FIELDCAT-SP_GROUP = 'A'.
    Regards
    Rajkumar Narasimman

  • How to select multiple lines in ALV report

    hi gurus,
    I am working on an interactive ALV report where i have to select multiple lines from the basic list into an internal table, based on check box clicks. Using RS_SELFIELD i can select only 1 row. The coding has been done based on Call Function. Can u please suggest some way.
    Regards,
    Satyajit

    hi,
    try like this
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    TYPES: BEGIN OF t_ekko,
      sel,                         "stores which row user has selected
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          fieldcatalog1 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE slis_layout_alv,
          gd_repid     LIKE sy-repid.
    DATA : BEGIN OF det_tab OCCURS 0,
            ebeln LIKE ekpo-ebeln,
           END OF det_tab.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-do_sum      = 'X'.        "Display column total
      fieldcatalog-datatype     = 'CURR'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    FORM build_layout.
      gd_layout-box_fieldname     = 'SEL'.
      "set field name to store row selection
      gd_layout-edit              = 'X'. "makes whole ALV table editable
      gd_layout-zebra             = 'X'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = gd_repid
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_pf_status_set = 'SET_STAT'
          is_layout                = gd_layout
          it_fieldcat              = fieldcatalog[]
          i_save                   = 'X'
        TABLES
          t_outtab                 = it_ekko
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDFORM.                    " DATA_RETRIEVAL
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
          IF rs_selfield-fieldname = 'EBELN'.
            READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
            SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
            CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
          ENDIF.
        WHEN 'DET'.  "button add by me
          CLEAR det_tab.
          REFRESH det_tab.
          LOOP AT it_ekko INTO wa_ekko WHERE sel = 'X'.
            MOVE-CORRESPONDING wa_ekko TO det_tab.
            APPEND det_tab.
          ENDLOOP.
          PERFORM build_cat.
          PERFORM dis_data.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  set_stat
    *       text
    *      -->RT_EXTAB   text
    FORM set_stat USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTAT' EXCLUDING rt_extab.
    ENDFORM.                    "set_stat
    *&      Form  build_cat
    *       text
    FORM build_cat.
      CLEAR fieldcatalog1.
      REFRESH fieldcatalog1.
      fieldcatalog1-fieldname = 'EBELN'.
      fieldcatalog1-tabname = 'DET_TAB'.
      fieldcatalog1-seltext_m = 'Order No.'.
      fieldcatalog1-outputlen = 10.
      APPEND fieldcatalog1 TO fieldcatalog1.
      CLEAR fieldcatalog1.
    ENDFORM.                    "build_cat
    *&      Form  dis_data
    *       text
    FORM dis_data.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = 'ZTEST_DS'
          it_fieldcat        = fieldcatalog1[]
          i_save             = 'X'
        TABLES
          t_outtab           = det_tab.
    ENDFORM.                    "dis_data
    here i have copied standard gui status of ALV into my z status ZSTAT and add one button DET......
    here u can select morethan one line using control(ctrl)
    reward if usefull...

Maybe you are looking for