cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Table row not selected, on_lead_select not fired

Former Member
0 Kudos

Hi all,

I build a ALV grid with a dynamic node:


IF lv_check_child_node NE 'X'.
     CALL METHOD lo_nd_root->add_new_child_node
        EXPORTING
*          supply_method                =
*          supply_object                =
*          dispose_method               =
*          dispose_object               =
*          static_element_type          =
          name                         = 'ALV_RESULT'
          is_mandatory                 = abap_true
          is_mandatory_selection       = abap_false
          is_multiple                  = abap_true
          is_multiple_selection        = abap_false
          is_singleton                 = abap_true
          is_initialize_lead_selection = abap_false
          static_element_rtti          = lr_strucdescr
          is_static                    = abap_true
*          attributes                   =
        RECEIVING
          child_node_info              = lo_nd_alv_result.
    ENDIF.
    lo_nd_result = wd_context->get_child_node( name = lv_tab_name ).
    lo_nd_result->bind_table( new_items = <lt_alv_tab> ).

* Instantiate ALV component
    l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
    IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
      l_ref_cmp_usage->create_component( ).
    ENDIF.

    lo_nd_result = wd_context->get_child_node( name = lv_tab_name ).
    l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
    l_ref_interfacecontroller->set_data(

      r_node_data = lo_nd_result ).

    l_ref_interfacecontroller->get_model( RECEIVING value = lr_cmdl ).

    lr_cmdl->if_salv_wd_std_functions~set_export_allowed( abap_false ).
    lr_cmdl->if_salv_wd_std_functions~set_pdf_allowed( abap_false ).
    lr_cmdl->if_salv_wd_table_settings~set_fixed_table_layout( abap_true ).
*  lr_cmdl->if_salv_wd_table_settings~set_design( cl_wd_table=>e_design-alternating ).
    lr_cmdl->if_salv_wd_table_settings~set_selection_mode( cl_wd_table=>e_selection_mode-single ).
    lr_cmdl->if_salv_wd_table_settings~set_cell_action_event_enabled( value = abap_true ).
    lr_cmdl->if_salv_wd_table_settings~set_data_check( if_salv_wd_c_table_settings=>data_check_on_cell_event ).
*    lr_cmdl->if_salv_wd_table_settings~set_read_only( value = abap_false ).
*    lr_cmdl->if_salv_wd_table_settings~set_enabled( value = abap_true ).
    lr_cmdl->if_salv_wd_table_settings~set_row_selectable( value = abap_true ).

    IF lt_fieldcat IS NOT INITIAL.
      lt_col = lr_cmdl->if_salv_wd_column_settings~get_columns( ).
      LOOP AT lt_fieldcat INTO ls_fieldcat.
        READ TABLE lt_col INTO ls_col WITH KEY id = ls_fieldcat-fieldname.
        IF sy-subrc = 0.
          ls_col-r_column->set_position( ls_fieldcat-col_pos ).
          CALL METHOD ls_col-r_column->get_header
            RECEIVING
              value = lr_header.
          lr_header->set_ddic_binding_field( if_salv_wd_c_ddic_binding=>ddic_bind_none ).
          lv_headertx = ls_fieldcat-seltext_l.
          lr_header->set_text( lv_headertx ).
        ELSE.
          ls_col-r_column->set_visible( cl_wd_uielement=>e_visible-none ).
        ENDIF.
      ENDLOOP.
    ENDIF.

But when I execute the dynpro, I get all the data I want. But I cannot select any row and the ON_LEAD_SELECT is not executed (an eventhandler is made in the method tab, and the event is bind to this handler).

When I change from selection_mode single to single_no_lead, I can select the row but the event is still not executed (not strange).

Is there anybody who can help me. We have support package SAPKB70020.

Regards,

Michael

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Sorry, for the layout. But the code markups doesn't work.

Former Member
0 Kudos

Have you set the Initialization Lead Selection of the node as abap_true?

Also Check the below thread:

Former Member
0 Kudos

Yes, I did now. But it still doesn't solve the issue.

Former Member
0 Kudos

Hi Michael,

We cannot get the lead selected row like the way we get for normal table display. We need to handle the onleadselect event of the ALV table in our view and then get the selected row.

Regards,

Chiranjeevi.

Former Member
0 Kudos

That is just the issue, I registered the event. But it is not fired when I select an row.