Hi Chandra
If you do not make additional settings, normally ALV Grid is in non-editable format. Hence, if your ALV Grid is editable, you should have done some settings.
i. Clear all "edit" field contents for all fields from the field catalog.
ii. If you use a style table, ensure to have not any adjustments making any sell editable.
If these things are not so familiar to you, I suggest you to inspect the tutorial "An" target="_blank">www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf">"An Easy Reference For ALV Grid Control".
<i>And as a last thing, let me introduce you the SDN forums pointing system: You can assign points to posts you find helpful while solving your question. You can reward points by clicking the yellow star icon at header of each reply post. You can reward;
- one 10 points (solved)
- two 6 points (very helpful answer)
- many 2 points (helpful answer)</i>
Kind Regards...
*--Serdar
I have posted code below, could you pls confirm.
REPORT ZALVTEST .
TYPE-POOLS: icon. TABLES: ZSFLIGHT.
CLASS lcl_event_receiver DEFINITION DEFERRED.
DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
DATA: ok_code LIKE sy-ucomm,
g_wa_sflight LIKE sflight.
DATA:go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container,
o_event_receiver TYPE REF TO lcl_event_receiver.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
Event handler method for event toolbar.
CONSTANTS:
Constants for button type
c_button_normal TYPE i VALUE 0,
c_menu_and_default_button TYPE i VALUE 1,
c_menu TYPE i VALUE 2,
c_separator TYPE i VALUE 3,
c_radio_button TYPE i VALUE 4,
c_checkbox TYPE i VALUE 5,
c_menu_entry TYPE i VALUE 6.
DATA:
ls_toolbar TYPE stb_button.
Append seperator to the normal toolbar
CLEAR ls_toolbar.
MOVE c_separator TO ls_toolbar-butn_type..
APPEND ls_toolbar TO e_object->mt_toolbar.
Append a new button that to the toolbar. Use E_OBJECT of
event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
This class has one attribute MT_TOOLBAR which is of table type
TTB_BUTTON. The structure is STB_BUTTON
CLEAR ls_toolbar.
MOVE 'REFRESH' TO ls_toolbar-function.
MOVE icon_REFRESH TO ls_toolbar-icon.
MOVE 'Change flight' TO ls_toolbar-quickinfo.
MOVE 'Refresh' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD handle_user_command.
Handle own functions defined in the toolbar
CASE e_ucomm.
WHEN 'CHANGE'.
Perform Loaddata.
CALL METHOD go_grid->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
CALL SCREEN 300.
MODULE STATUS_0300 OUTPUT.
Create objects
IF go_custom_container IS INITIAL.
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ZCUSTOM'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
Perform Loaddata.
ENDIF.
ENDMODULE. " STATUS_0300 OUTPUT
FORM Loaddata.
Read data from table SFLIGHT
SELECT * FROM sflight INTO TABLE gi_sflight.
Load data into the grid and display them
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
CHANGING it_outtab = gi_sflight.
CALL METHOD go_grid->set_toolbar_interactive.
ENDFORM.
Add a comment