‎2007 Feb 08 8:37 AM
Hi,
I was printed the ALV report to custom control. Now I want to change some datas from ALV report and save the datas into an one internal table. Is any function module is there for saving the datas from ALV report into an Internal Table?
Thanks.
‎2007 Feb 08 12:54 PM
Hi Vijay,
1. In ALV's we can set a column for editing in the fieldcatalog level...
<l_fcat>-edit = 'X'.
or at each cell level...with the CELLSTYLE properties...
2. a) The ALV grid control has some events that are given for the
grid control class CL_GUI_ALV_GRID.
b) Whenever user interacts with the grid and changes the cell values..
DATA CHANGED event is triggered...
c) The user action is handled by the receiver event class that
we need to handle......
----
Class Definition
----
CLASS <reciever class> DEFINITION.
PUBLIC SECTION.
METHODS:
Handle hotspot
handle_hotspot_click
FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id
e_column_id,
Data Changed
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed,
Data changed Finished
handle_data_changed_finished
FOR EVENT data_changed_finished OF cl_gui_alv_grid
IMPORTING e_modified.
ENDCLASS.
----
Class implementation
----
CLASS <receiver class> IMPLEMENTATION.
Data Changed
METHOD handle_data_changed.
PERFORM data_changed USING er_data_changed.
ENDMETHOD.
Data Finished
METHOD handle_data_changed_finished.
PERFORM data_changed_finished.
ENDMETHOD.
Hotspot clicked
METHOD handle_hotspot_click.
perform hotspot_click USING e_row_id
e_column_id.
ENDMETHOD.
ENDCLASS.
DATA:
w_event TYPE REF TO lcl_brly_frt_event_receiver.
‎2007 Feb 08 1:18 PM
Hi vijay,
place a button save in grid control
CLASS myclass DEFINITION.
PUBLIC SECTION.
METHODS:
toolbar FOR EVENT toolbar OF cl_gui_alv_grid IMPORTING e_object
e_interactive,
user_command FOR EVENT user_command OF cl_gui_alv_grid IMPORTING
e_ucomm.
ENDMETHOD.
ENDCLASS.
CLASS myclass IMPLEMENTATION.
METHOD toolbar.
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
MOVE 3 TO ls_toolbar-butn_type.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'SAVE' TO ls_toolbar-function.
MOVE 'SAVE' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD user_command.
CASE e_ucomm.
WHEN 'SAVE'.
CALL METHOD obj_grid->refresh_table_display.
ENDCASE.
ENDMETHOD.
ENDCLASS.
SET HANDLER obj_myclass->toolbar FOR obj_grid.
SET HANDLER obj_myclass->user_command FOR obj_grid.