cancel
Showing results for 
Search instead for 
Did you mean: 

action on alv table dropdown field

Former Member
0 Kudos

Hello Gurus,

i have alv table with some fields .in that one field is dropdown contains YES and NO values.if i select YES value for that field i

need to set some fields in editable mode in that same row or else if i select NO value those fields are in greyout.

this is my requirement.how can i achive this requirement.could you suggest me on this.could you send me sample code or

reference links if poosible.

Could anyone please suggest solutions?

and if possible send me the sample code for this requirement.

Thanks in Advance for your replies.

Regards,

Babu

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

    1. Create a context attribute READ_ONLY in the node to whcih the ALV is bound.

    1. Implement the column settings.

For those columns which you want to make them enable/disbale for those columns

create a input field CL_SALV_WD_UIE_INPUT_FIELD for that alv config object CL_SALV_WD_CONFIG_TABLE.

  • there are many thread on the same please search SCN.

data lo_config type ref to cl_salv_wd_config_table. "model object

* GET THE MODEL OBJECT USING CODE WIZARD
*GET THE COLUMN SETTINGS GET_COLUMNS of IF_SALV_WD_COLUMN_SETTINGS of CL_SALV_WD_CONFIG_TABLE
* LOOP AT THESE COLUMNS and create an INPUT field for those columns to enable/disbale 
* pass this read_only field name
lo_input->GET_READ_ONLY_FIELDNAME
VALUE( 'READ_ONLY' ).

    1. First Time in WDODOINIT-

I suppose that dropdown column as NO for all rows.

If that dropdown column name is CHOOSE

LOOP AT IT_TAB into WA_ITAB.
IF wa_itab-choose = 'NO'.
wa_itab-read_only = abap_true. "disbale
ELSE.
wa_itab-read_only = abap_false. "Enabale
ENDIF.
ENDLOOP.
    1. Next when the drop down is selected then ON_DATACHECK event gets triggered (or check for other event also)

Implement this event handler

You will get the index in this Method importing parameters

Try to read the node at that index. - USe code wizard

DATA LO_NODE type ref to if_wd_context_node.
LO_NODE = WD_context->get_child_node ( 'TEST' ). "node name
LO_ELEMENT = LO_NODE->GET_ELEMENT ( index = lv_index ).
if LO_ELEMENT is bound.
LO_ELEMENT->set_static_attribute
importing 
name = 'READ_ONLY'
exporting
value = abap_false.  "enable
endif.

Hope this helps.

Regards,

Lekha.