cancel
Showing results for 
Search instead for 
Did you mean: 

The index of selected row in table

Former Member
0 Kudos

Hi experts,

I have a table in my view and the table have some records, I select one of the record and hit the button on 'Modify', then I want two field of the selected record to be input ready. is it possible to do this?

Because I tried some ways that told in the forums but faild to got the index of the record that I selected in table.

I unchecked the checkbox of 'Initialization Lead Selection' of the node which the table is binded, and found when I use the method of

lead_selection_index = lo_nd_node_materialnum->get_lead_selection_index( ).

the index I got is always 2-....no matter which record I selected..

How to locate which row of the table that I'm seleted?

Please help me on this..

Thanks for your time!

Anna

Accepted Solutions (0)

Answers (3)

Answers (3)

Madhu2004
Active Contributor
0 Kudos

You can have the cell variiant and have input filed , text view.

Based on the requirement you put the active cell variant.

Regards,

Madhu

Former Member
0 Kudos

I realized why the index is not correct, I define a event in property 'onSelect' of the table

and then use code wizard to read the node that the table is bonded.

Then I could get the correct record.

But I still have a problem....

When I select a record of the table, I want two fields of the selected record to be input ready, these two fields of other records is still read-only.

How could I do this?

Please help

Thanks!

Anna

Former Member
0 Kudos

Try to use the Read only property of the UI elements inside the table.

ChrisPaine
Active Contributor
0 Kudos

I the event that you are getting your element, update an attribute of that element of type WDY_BOOLEAN - set this element to abap_false.

Bind this attribute to the readOnly property of the two input fields that you want to enable.

in the creation of your context, set this attribute equal to abap_true.

your event now should trigger the "enabling" of the two fields.

Former Member
0 Kudos

Anna - myinfo is the following, please replace with your info:

ALV component use = ALV_PREAWARD

attribute inside node that is binded to the ALV = ZZRR_BUYER_REAMRKS

the attribute is the column I want as input field in my ALV.



DATA: lr_input_field                TYPE REF TO cl_salv_wd_uie_input_field,
	l_col_name                      TYPE string,
	lr_column_settings          TYPE REF TO if_salv_wd_column_settings,
	lt_columns                       TYPE salv_wd_t_column_ref,
        ls_column                        TYPE salv_wd_s_column_ref,
	l_value_column_new       TYPE REF TO cl_salv_wd_config_table,
	lr_column           		 TYPE REF TO cl_salv_wd_column,
        lr_cmp_usage                   TYPE REF TO if_wd_component_usage.


     lr_cmp_usage = wd_this->wd_cpuse_alv_preaward( ).
  IF lr_cmp_usage->has_active_component( ) IS INITIAL.
    lr_cmp_usage->create_component( ).
  ENDIF.

    lt_columns = l_value_column->if_salv_wd_column_settings~get_columns( ).

LOOP AT lt_columns INTO ls_column.
      l_col_name = ls_column-r_column->get_id( ).

IF l_col_name EQ 'ZZRR_BUYER_REMARKS'.
        lr_column_settings ?= l_value_column_new.
        lr_column = lr_column_settings->get_column( 'ZZRR_BUYER_REMARKS' ).
        CREATE OBJECT lr_input_field
          EXPORTING
            value_fieldname = 'ZZRR_BUYER_REMARKS'.
        lr_column->set_cell_editor( lr_input_field ).
     ELSEIF l_col_name EQ 'YOUR OTHER FIELD NAME THAT YOU WANT TO BE INPUT FIELD'
* DO THE SAME AS ABOVE
ENDIF.

ENDLOOP.

Hope this help!

Jason PV

Former Member
0 Kudos

Check [This|] one, how to get the table index.

Also try this [One|http://www.sapdev.co.uk/sap-webapps/sap-webdynpro/wdp-read-table.htm ] how to read the table entries.