‎2010 Nov 28 12:16 PM
Dear Expert,
I am using CL_ALV_GRID to let the user input some code in one filed then the it's text display in another field automatically.But I meet a problem , to display the changed data I have to use method 'refresh'. This method will refresh all the data, but user only want to display the changed data.
Is there any way to realize this kind of requirement ?
‎2010 Nov 28 3:03 PM
Hi Edward,
Instead of using REFRESH method use CHECK_CHANGED_DATA will make your final Internal Table (Used to display the data) with the updated values. After calling this method you need to write code for another field.
Please go through the below link for which I have given the solution for the similar requirement and I think it will definetly work for you.
[Update the Changed Data using the ALV methods|]
Let me know in case you face any problem in implementing this.
Regards,
SRinivas
‎2010 Nov 29 12:42 AM
Thanks for your reply . I think you miss understand my question.My problem is display the changed data without refreshing.
not how to get the changed data.
In the sample, it also works with call method sender->refresh_table_display. but this is not what I want.
nothing to do.
if e_column-fieldname ne 'CHECKBOX'.
exit.
endif.
read table gt_outtab into ls_outtab index es_row_no-row_id.
The loop is only needed if there are other columns that
use checkboxes. At this point the loop could be
replaced by a READ of the first line of CELLTAB.
loop at ls_outtab-celltab into ls_celltab.
if ls_celltab-fieldname eq 'CHECKBOX'.
§B4.Switch the style to dis- or enable a cell for input
if ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
else.
ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
endif.
modify ls_outtab-celltab from ls_celltab.
endif.
endloop.
modify gt_outtab from ls_outtab index es_row_no-row_id.
call method sender->refresh_table_display.
Edited by: Edward on Nov 29, 2010 8:42 AM
‎2010 Nov 29 6:22 AM
‎2010 Nov 29 9:20 AM
Hi expert,
Here data will be displayed on layout.After displaying the data first we need to modify the record after that selected that record
and press the CUSTOME REFRESH button only selected row is changed in internal table after that using set_table_for_fist_display using that method wt ever the modified the data in itab that data will display.
claSS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
MOVE 'REFRESH' TO ls_toolbar-function.
MOVE icon_refresh TO ls_toolbar-icon.
MOVE 'REFRESH SCREEN'(140) TO ls_toolbar-quickinfo.
MOVE 'DELETE DATA'(120) TO ls_toolbar-quickinfo.
MOVE 'REFRESH'(140) TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
ENDMETHOD.
ENDCLASS.
METHOD handle_user_command.
CASE e_ucomm.
WHEN 'REFRESH'.
CALL METHOD r_grid->get_selected_rows
IMPORTING
ET_INDEX_ROWS =
et_row_no = it_rows.
LOOP AT it_rows INTO wa_rows.
MODIFY DBTAB FROM TABLE ITAB INDEX WA_ROWS-INDEX.
ENDLOOP.
CALL METHOD r_grid->set_table_for_first_display
EXPORTING
is_layout = gs_layout "&see below
CHANGING
it_fieldcatalog = gt_fieldcat
it_outtab = ITAB.
ENDMETHOD.
STARTOFSELECTION.
CREATE OBJECT r_container
EXPORTING
container_name = 'CONTAINER_1'
CREATE OBJECT r_grid
EXPORTING
i_parent = r_container
SET HANDLER event_receiver1->handle_user_command FOR r_grid.
SET HANDLER event_receiver1->handle_toolbar FOR r_grid.
Regards
MURALII
‎2010 Nov 29 9:37 AM
Hi Edward,
I think the below method can solve your problem...
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER "MC_EVT_MODIFIED
EXCEPTIONS
ERROR = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
If we use MC_EVT_ENTER event, when entering the data the text will appear,
if we use MC_EVT_MODIFIED event, when using tab button in keyboard the text button will appear.
Use the above method in PBO, after displaying your ALV grid using SET_TABLE_FOR_FIRST_DISPLAY.
after which create a new instance for your local method...
CREATE OBJECT GR_EVENT_HANDLER .
SET HANDLER GR_EVENT_HANDLER->HANDLE_DATA_CHANGED FOR G_GRID .