Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

alv editable columns

Former Member
0 Kudos
82

Hello i wan't to put a column of an alv in non editable state depending a value introduced in another column. I have done it adding the cellstyles table to the internal table shown in the alv.

This is working fine, but in my alv i have the possibility of adding new lines and here is where i'm having trouble. When i add my first line and i introduce the value that must make another column non editable it works, but when i try to add a new line, the first row i addes loses it state and its shown editable.

Any idea?

Thanks

5 REPLIES 5

SimoneMilesi
Active Contributor
0 Kudos
44

You fill the cellstyles for the new row?

0 Kudos
44

Yes, the problem is that i don't know why the info relative cellstyles of the 'old' line dissapears.

0 Kudos
44

Are you usinge a common perform? Maybe you have a clear or a refresh that clear them.

Can you post the piece of code where you add the new line with the filling of cellstyles?

Btw, you can always do a loop on your output table and re-fill the cellstyles for all the rows (new and old).

0 Kudos
44

here is my code:

FORM f_handle_data_changed

USING pi_data TYPE REF TO cl_alv_changed_data_protocol.

DATA: ls_modi TYPE lvc_s_modi.

FIELD-SYMBOLS: <fs_value> TYPE ANY,

<fs> TYPE ty_co04_0019.

SORT pi_data->mt_mod_cells BY row_id .

LOOP AT pi_data->mt_mod_cells INTO ls_modi.

READ TABLE i_planifci ASSIGNING <fs> INDEX ls_modi-row_id.

ASSIGN COMPONENT ls_modi-fieldname OF STRUCTURE <fs>

TO <fs_value>.

IF sy-subrc = 0.

<fs_value> = ls_modi-value.

UNASSIGN <fs_value>.

****************************

IF ls_modi-fieldname = 'TIPO_PLAN'.

  • cambiar la editabilidad de las columnas en base al valor del tipo 1

  • READ TABLE i_planifci INTO w_planifci INDEX ls_modi-row_id.

PERFORM f_hacer_no_editables USING ls_modi-row_id

ls_modi-value

CHANGING <fs>.

ENDIF.

MODIFY i_planifci INDEX ls_modi-row_id FROM <fs>.

ENDIF.

ENDLOOP.

PERFORM f_refresh_table_display USING v_grid.

is it possible to loss the info of the cellstyles table cos i'm doing it on the handle_data_changed

0 Kudos
44

Hi,

Sine you are using in the perform of data change so, next time when you come and and a add a new line it will contain the field ''TIPO_PLAN' also... The if condition is again satisfied so it clears and becomes editable. put this out of this perform and i think it will work...