2007 Jan 12 4:53 AM
hi,
i have toolbars on grid control of my own choice.....so whenever
i create a new line or delete a line is it necessary to call SET_TABLE_FOR_
FIRST_DISPLAY ??? ...i tried to use REFRESH_TABLE_DISPLAY but
it didn't work....please let me know wat is the right procedure to display the grid
after performing create or deleting a line.....
thanks
Swaminathan.
hi,
i have toolbars on grid control of my own choice.....so whenever
i create a new line or delete a line is it necessary to call SET_TABLE_FOR_
FIRST_DISPLAY ??? ...i tried to use REFRESH_TABLE_DISPLAY but
it didn't work....please let me know wat is the right procedure to display the grid
after performing create or deleting a line.....
thanks
Swaminathan.
2007 Jan 12 5:01 AM
Hi,
Modify the internal table and then use refresh_table_display.
2007 Jan 12 7:51 AM
Hello Swami
I think you are mixing up different aspects of ALV list programming.
If your ALV list is editable (including adding and deleting rows) then you have to call method <b>go_grid->check_changed_data</b> in PAI of the dynpro hosting the ALV grid control in rorder to transfer the changes at the <i>frontend</i> (i.e. the control) to the <i>backend</i> (i.e. the output itab in your ABAP program).
If you want to modify the ALV toolbar dynamically please refer to my sample report in thread
<a href="https://forums.sdn.sap.com/click.jspa?searchID=713140&messageID=2884705">Thread: how to disable self defined button from ALV Toolbar when ok_code ='BACK'</a>
Regards
Uwe
2007 Jan 12 8:43 AM
Hi,
1. you require to define handle_data_changed method of lcl_event_receiver
class lcl_event_receiver definition.
handle_data_changed
for event data_changed of cl_gui_alv_grid
importing er_data_changed.
endclass. "lcl_event_receiver DEFINITION
2. After displaying ALV first time. call the above method.
start-of-selection.
call method g_alv_grid->set_table_for_first_display
EXPORTING
is_variant = variant
is_layout = layout
is_print = print
CHANGING
it_outtab = OUTPUT[] "internal anle
it_fieldcatalog = g_t_flcat[]. " field catalog
if sy-subrc <> 0.
write: 'Method call ''Set_table_for_first_display'' failed.'.
exit.
endif.
set handler g_alv_event->handle_data_changed
for g_alv_grid.
3. in the implementation of method
call refresh grid.
data: g_stable type LVC_S_STBL.
method handle_data_changed.
//code to modify internal table
Refresh the Grid without changing the current view
g_stable-row = '1'.
call method g_alv_grid->refresh_table_display
exporting IS_STABLE = g_stable.
endmethod.
2007 Jan 15 9:12 AM
Hi Check this code
IF w_custom_container IS INITIAL.
IF cl_gui_alv_grid=>offline( ) IS INITIAL.
CREATE OBJECT w_custom_container
EXPORTING container_name = w_container.
*-- Create Object for ALV grid ----------------------------------------*
CREATE OBJECT w_grid
EXPORTING
i_parent = w_custom_container
i_appl_events = 'X'
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5.
*-- Build Field Catalog -----------------------------------------------*
IF t_fieldcat IS INITIAL.
PERFORM build_fieldcatalog.
ENDIF.
*-- Exclude Unwanted Functions ----------------------------------------*
IF t_tlexcl IS INITIAL.
PERFORM sub_exclude_functions.
ENDIF.
* Set The ALV Layout --------------------------------------------------*
* Helps to make the individual cell enable / Disable ------------------*
* We have to define this in the out tab for reference -----------------*
wa_layout-stylefname = 'CELL_STYLE'.
*-- Fill the initial Line If there is no records in the table ---------*
IF t_outtab IS INITIAL.
PERFORM fill_initial_line.
ENDIF.
*-- Call ALV grid -----------------------------------------------------*
CALL METHOD w_grid->set_table_for_first_display
EXPORTING is_layout = wa_layout
i_save = c_variant_save
is_variant = wa_variant
it_toolbar_excluding = t_tlexcl
CHANGING it_fieldcatalog = t_fieldcat
it_outtab = t_outtab.
INSERT LINES OF t_outtab INTO TABLE t_database.
*-- Set editable cells to ready for input -----------------------------*
CALL METHOD w_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
*-- Get the Instanse for event handling -------------------------------*
CREATE OBJECT w_event_receiver.
*-- Register the events -----------------------------------------------*
CALL METHOD w_grid->register_edit_event
EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter.
*-- Set handlers ------------------------------------------------------*
SET HANDLER w_event_receiver->handle_data_changed FOR w_grid.
SET HANDLER w_event_receiver->handle_item_changed_finished
FOR w_grid.
SET HANDLER w_event_receiver->handle_user_command FOR w_grid.
SET HANDLER w_event_receiver->handle_toolbar FOR w_grid.
SET HANDLER w_event_receiver->handle_item_hot_spot FOR w_grid.
*-- Set the tool bar active -------------------------------------------*
CALL METHOD w_grid->set_toolbar_interactive.
*-- Disable edit mode on that row deleted -----------------------------*
CALL METHOD w_grid->get_backend_fieldcatalog
IMPORTING
et_fieldcatalog = tl_fieldcatalog.
IF sy-subrc = 0.
CLEAR wa_outtab.
LOOP AT tl_fieldcatalog ASSIGNING <l_fcat>.
wal_cell_stl-fieldname = <l_fcat>-fieldname.
wal_cell_stl-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT wal_cell_stl INTO TABLE wa_outtab-cell_style.
ENDLOOP.
LOOP AT t_outtab ASSIGNING <fs_outtab> WHERE lock_by NE space.
<fs_outtab>-cell_style = wa_outtab-cell_style.
ENDLOOP.
CALL METHOD w_grid->refresh_table_display.Thanks
Anirban M.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |