‎2009 Mar 21 6:42 AM
Hi,
I have created an ALV, where one column of Amt is editable.
Now consider i have 4 rows and I am editing 2 rows, i want to know how many rows are edited with some flag or something.
Can anybody help me regarding this.
Regards.
‎2009 Mar 21 1:59 PM
‎2009 Mar 21 6:47 AM
Hi,
in this cas u need to create one more internal table with the same data selected and need to compare the data from the table from ALV. Ex :
IT_MAT1[] = IT_MAT.
"in the USER_COMMAND routine use this
DATA: GD_REPID LIKE SY-REPID,
REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C.
*Code to reflect the changes done in the internal table
IF REF_GRID IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF_GRID.
ENDIF.
IF NOT REF_GRID IS INITIAL.
CALL METHOD REF_GRID->CHECK_CHANGED_DATA
IMPORTING
E_VALID = L_VALID.
ENDIF.
LOOP AT IT_MAT."IT_MAT is the internal table from ALV
READ TABLE IT_MAT1 WITH KEY MATNR IT_MAT-MATNR.
IF SY-SUBRC = 0.
IF IT_MAT-MTAKL <> IT_MAT1-MTAKL.
"KEEP FLAG HERE ARE ANY MESSAGE
ENDIF.
. " Check for all fields and set the flag
.
.
ENDLOOP.
‎2009 Mar 21 6:48 AM
Hi,
If you want to make the whole ALV editable, call method set_ready_for_input of ALV class with parameter set to '1'
If you want to make some rows of the ALV editable->
In the example program BCALV_EDIT_2 there is a subroutine named fill_celltab. In this subroutine, the internal table attached to each row of the output table is filled which shows which fields of this row is editable. If you enter a row to this internal table without a fieldname, then the edit status of the entire row is affected.
Hope it helps.
Regards
Rajesh Kumar
‎2009 Mar 21 8:39 AM
Hi,
This may help u...
DATA: event_receiver TYPE REF TO lcl_event_receiver.
*----------------------------------------------------------------------*
* CLASS lcl_event_receiver DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed sender. "#EC NEEDED
ENDCLASS. "lcl_event_receiver DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_event_receiver IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
METHOD handle_data_changed.
DATA: ls_good TYPE lvc_s_modi.
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
CASE ls_good-fieldname.
...........
ENDCASE.
ENDLOOP.
ENDMETHOD. "handle_data_change
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
i_save = 'A'
i_default = 'X'
is_variant = gs_variant
is_layout = gs_layout
it_toolbar_excluding = lt_exclude
CHANGING
it_outtab = it_rfqi[]
it_fieldcatalog = gt_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
CALL METHOD gr_alvgrid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
CALL METHOD gr_alvgrid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
SET HANDLER event_receiver->handle_data_changed FOR gr_alvgrid.
‎2009 Mar 21 1:59 PM