Application Development and Automation 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: 
Read only

alv edit

Former Member
0 Likes
503

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.

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
475

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

3 REPLIES 3
Read only

GuyF
Active Participant
0 Likes
475

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.

Read only

Former Member
0 Likes
475

Hi,

Check the following sample programs:

BCALV_EDIT*

Hope this gives you some idea.

Regards,

Gilberto Li

Read only

uwe_schieferstein
Active Contributor
0 Likes
476

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