03-17-2008 10:56 AM
hi can anyone help me in selection and deselection of all check boxes of a particular node. just send me some sample code.
thanks,
hema.
03-17-2008 10:59 AM
hi, chk this. this will help u.
CLASS lcl_event_receiver DEFINITION DEFERRED. "local class to handle semantic checks
DATA : g_event_receiver TYPE REF TO lcl_event_receiver. "Object declaration of class LCL_EVENT_RECEIVER
LOCAL CLASS Definition
*§4.Define and implement event handler to handle event DATA_CHANGED.
*
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed.
PRIVATE SECTION.
This flag is set if any error occured in one of the
following methods:
DATA: error_in_data TYPE c.
Methods to modularize event handler method HANDLE_DATA_CHANGED:
METHODS: check_sel
IMPORTING
ps_good_sel TYPE lvc_s_modi
pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
ENDCLASS. "lcl_event_receiver DEFINITION
-
-
CLASS lcl_event_receiver IMPLEMENTATION
-
-
*
-
-
CLASS lcl_event_receiver IMPLEMENTATION .
METHOD handle_data_changed.
DATA: ls_sel TYPE lvc_s_modi.
error_in_data = space.
my_error_in_data = space.
*§5.Loop over table MT_GOOD_CELLS to check all values that are
valid due to checks according to information of the DDIC.
LOOP AT er_data_changed->mt_good_cells INTO ls_sel.
CASE ls_sel-fieldname.
check if column EREQTY of this row was changed
WHEN 'SEL'.
CALL METHOD check_sel
EXPORTING
ps_good_sel = ls_sel
pr_data_changed = er_data_changed.
ENDCASE.
ENDLOOP.
*§7.Display application log if an error has occured.
IF error_in_data EQ 'X'.
CALL METHOD er_data_changed->display_protocol.
ENDIF.
ENDMETHOD. "handle_data_changed
*..................................................
Overview of checks according to field EREQTY
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a) Does the EREQTY exists? (check against check table LFA1)
*...................................................
METHOD check_sel.
DATA: sel(1) TYPE c,
ls_lfa1 TYPE lfa1.
Get new cell value to check it.
(In this case: EREQTY).
CALL METHOD pr_data_changed->get_cell_value
EXPORTING
i_row_id = ps_good_sel-row_id
i_fieldname = ps_good_sel-fieldname
IMPORTING
e_value = sel.
IF sy-subrc NE 0.
CALL METHOD pr_data_changed->add_protocol_entry
EXPORTING
i_msgid = '0K'
i_msgno = '000'
i_msgty = 'E'
i_msgv2 = sel
i_fieldname = ps_good_sel-fieldname
i_row_id = ps_good_sel-row_id.
error_in_data = 'X'.
my_error_in_data = 'X'. "Will be used at the time of saving the data.
EXIT. "ERROR!
ENDIF.
ENDMETHOD. "CHECK_PRINT
ENDCLASS. "LCL_EVENT_RECEIVER IMPLEMENTATION
&----
-
CALL METHOD grid->check_changed_data.
cheers,
madhu.
03-23-2008 1:41 PM