cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting a Row in ALV webdnpro

laeeqsiddique
Participant
0 Kudos

Hi Friends,

I'm facing a problem. I'm trying to select a rown in ALV but doesnot allow me to that. It is default to first row (lead selection) but not able to select any other row.

Here is my code inside wddoinit. Thanks in advance I hope someone will help me.

DATA: lr_ref_cmp_usage     TYPE REF TO if_wd_component_usage,
        lr_ref_if_controller TYPE REF TO iwci_salv_wd_table,
        lr_config_model      TYPE REF TO cl_salv_wd_config_table,
        lr_field_settings    TYPE REF TO if_salv_wd_field_settings,
        lr_field             TYPE REF TO cl_salv_wd_field.
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.

lo_cmp_usage =   wd_this->wd_cpuse_zalv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
  lo_cmp_usage->create_component( ).
ENDIF.

* Get config model
DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
l_ref_interfacecontroller = wd_this->wd_cpifc_zalv( ).
DATA: l_value TYPE REF TO cl_salv_wd_config_table.
l_value = l_ref_interfacecontroller->get_model( ).
CALL METHOD l_value->if_salv_wd_table_settings~set_row_selectable
  EXPORTING
    value  = ABAP_TRUE
    .




DATA: lr_table_settings    TYPE REF TO if_salv_wd_table_settings,
        lv_text               TYPE        string.

  lr_table_settings ?= l_value.
*  lr_table_settings->set_fixed_table_layout( abap_true ).
*  lr_table_settings->set_visible_row_count( -1 ).
  lr_table_settings->set_footer_visible( 0 ).
  lr_table_settings->set_design( '00' ).
* Sort data records default

Laeeq Siddique

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I think, apart from enabling selection in ALV, you have to write code to select the particular context element in the table binded to ALV. You can try below in INIT method code and this might work.

data: node type REF TO if_wd_context_node.
Node = wd_Context->get_Child_Node( Name = 'NODE_NAME' ).

* call this method to set the lead selection index
node->SET_LEAD_SELECTION_INDEX( n ) " n is the index of the row you want to select

Regards,

Manne.

laeeqsiddique
Participant
0 Kudos

Hi Manne,

How do we get "n" here? I'm selecting it on screen and it is not letting me do that.

Regards,

Laeeq Siddique

laeeqsiddique
Participant
0 Kudos

Any views on this guys? I'll be grateful..

Answers (2)

Answers (2)

laeeqsiddique
Participant
0 Kudos

I made a mistake by selecting first row in WDDOMODIFY method so it was just not letting me select any other row.

former_member196023
Active Participant
0 Kudos

Iif you wish to select multiple rows in ALV then you need to change selection property of context node to 0..N or 1..N.