cancel
Showing results for 
Search instead for 
Did you mean: 

Editable / Non editable input field CELL (individually) on ALV dynamically

former_member189690
Participant
0 Kudos

Hi again,

I need more help with an issue.

I have an ALV table with three columns that is necessary put values into input field cell editors, but these cells should be editable or not depending of business logic. I've got make editable or non in entire ROW LEVEL (method set_read_only_fieldname( 'READ_ONLY' )., but ¿how can I set editable or non at individual cells?

Any idea to do that?

Regards

Edited by: vanbelal on Mar 24, 2010 3:33 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You need to create another variable / field to the context node which is bound to the ALV and set the values for it dynamically based on business logic.

Then use this fields value in the WDDOINIT of the view holding the ALV component to make individual cell active / inactive.

Get the ref. to all the columns and set them based on the value of this additional field.

Thanks,

Abhishek

former_member189690
Participant
0 Kudos

Can you paste any example source code?

I don't know how can I bind enabled property dynamically to individual CELL, I'm setting properties to whole column.

lt_columns = lr_column_settings->get_columns( ).

LOOP AT lt_columns INTO ls_columns.

if ls_columns-id = 'COLUMN1' or 'COLUMN2' or 'COLUMN3'.

CREATE OBJECT lr_input_field

EXPORTING

value_fieldname = ls_columns-id.

ls_columns-r_column->set_cell_editor( lr_input_field ).

  • Should I put business logic here? how can I set enabled or not on CELL, at this point I'm processing whole column!!

lr_input_field->set_enabled( abap_true ).

endif.

ENDLOOP.

Edited by: vanbelal on Mar 24, 2010 4:12 PM

Former Member
0 Kudos

the code will go some like this:

  • lets say CELL_INPUT is the field added to the context which will be set

  • now in the WDDOINIT of the view . get the ref of all the columns then loop thru

LOOP AT GT_COLUMNS INTO GS_COLUMN.

CASE GS_COLUMN-ID.

WHEN 'FIELD1'. "this cell we are interested in

DATA: LR_INPUT TYPE REF TO CL_SALV_WD_UIE_INPUT_FIELD.

CREATE OBJECT LR_INPUT

EXPORTING

VALUE_FIELDNAME = GS_COLUMN-ID.

LR_INPUT->SET_READ_ONLY( CELL_INPUT ). "this will dynamically make it write protected

GS_COLUMN-R_COLUMN->SET_CELL_EDITOR( LR_INPUT ).

ENDCASE.

ENDLOOP.

This should work. I have not tried it but should work

Thanks,

Abhishek

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Refer to this link which has the code snippet which would be useful -

[Editable ALV with check box|http://divulgesap.com/blog.php?p=Njc=]

Cheers,

Ravi

former_member189690
Participant
0 Kudos

Thanks, solved problem.

I've used a read only field for each column that I want to hide/show, and I've used method SET_READ_FIELDNAME ( 'FIELD') and it works!!!