on 03-24-2010 2:33 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.