‎2009 Feb 02 7:31 PM
Hi all,
I want to edit the ALV grid for particular column when ever i click the button on application tool bar,
please tell me how to do that.
regards,
rakesh.
‎2009 Feb 02 8:57 PM
Hello Rakesh
Report BCALV_FIELDCAT_TEST shows you how changes of the fieldcatalog affect the display of the ALV.
In your case the logic is quite simple:
" User command module at PAI:
CASE gd_okcde.
WHEN 'SWITCH'. " switch editable / non-editable
PERFORM switch.
...
FORM switch.
"(1) Read current fieldcatalog
go_grid->get_frontend_layout( ).
"(2) Mark / Unmark EDIT flag in fieldcatalog
LOOP AT gt_fcat INTO ls_fcat
WHERE ( fieldname = '<name of column>' ). " which you want to edit
IF ( ls_fcat-edit = 'X' ).
ls_fcat-edit = space.
ELSE.
ls_fcat-edit = 'X'.
ENDIF.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
ENDLOOP.
"(3) Set modified fieldcatalog:
go_grid->set_frontend_layout( ).
ENDFORM.
Regards
Uwe
‎2009 Feb 02 8:00 PM
Hi,
If you want to edit for a single cell, you can either use a button on the toolbar or with hotspot/double click, and then open a popup where the user enters text.
Let me know if you want an example.
Guy.
‎2009 Feb 02 8:01 PM
Hi,
Check the following sample programs:
BCALV_EDIT*
Hope this gives you some idea.
Regards,
Gilberto Li
‎2009 Feb 02 8:57 PM
Hello Rakesh
Report BCALV_FIELDCAT_TEST shows you how changes of the fieldcatalog affect the display of the ALV.
In your case the logic is quite simple:
" User command module at PAI:
CASE gd_okcde.
WHEN 'SWITCH'. " switch editable / non-editable
PERFORM switch.
...
FORM switch.
"(1) Read current fieldcatalog
go_grid->get_frontend_layout( ).
"(2) Mark / Unmark EDIT flag in fieldcatalog
LOOP AT gt_fcat INTO ls_fcat
WHERE ( fieldname = '<name of column>' ). " which you want to edit
IF ( ls_fcat-edit = 'X' ).
ls_fcat-edit = space.
ELSE.
ls_fcat-edit = 'X'.
ENDIF.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
ENDLOOP.
"(3) Set modified fieldcatalog:
go_grid->set_frontend_layout( ).
ENDFORM.
Regards
Uwe