01-29-2008 9:42 AM
Hi,
In the o/p screen i have 4 push buttons checkall,uncheckall,change,export.There were few records present in the o/p screen and beside each record there is a checkbox.Now if the checkall pushbutton is clicked,then all the checkboxes have to be selected.If the uncheckall pushbutton is clicked,the all the checkboxes have to be unchecked.If the change pushbutton is clicked,then the control should go to next screen.How can I write the code for all the checkboxes to be selected or unselected?
Regards,
Hema
01-29-2008 9:46 AM
use AT SELECTION-SCREEN event to write your code.
Just check the value of the checkbox and process acordingly.
For Check value is 'X' and SPACE for uncheck.
say -
If v_uncheckall = 'X'.
v_check = space.
v_export = space.
v_change = space.
endif.
Regards,
Amit
Reward all helpful replies.
01-29-2008 9:47 AM
in user command u can write the following code:
case sy-ucomm.
when 'checkall'.
ck1 = 'X'.
ck2 = 'X'.
ck3 = 'X'.
ck4 = 'X'.
when 'uncheckall'.
clear: ck1,ck2,ck3,ck4.
endcase.
here ck1,2,3,4 are ckech box name and also declare char variable with the same name into the prog.
I think this will help u.
thanks
Dharmishta
01-29-2008 10:00 AM
Hi,
In my program 'REUSE_ALV_FIELD_CATALOG_MERGE' function module was used to declare the field catalog.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-cprog
i_internal_tabname = 'OUTPUT'
i_inclname = sy-cprog
i_bypassing_buffer = 'X'
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS "#EC *
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
LOOP AT gt_fcat INTO gs_fcat WHERE fieldname = 'CHECKBOX'.
gs_fcat-checkbox = 'X'.
gs_fcat-edit = 'X'.
MODIFY gt_fcat FROM gs_fcat.
ENDLOOP.
gs_layout-zebra = 'X'.
gs_layout-colwidth_optimize = 'X'.
In this case,how can I check or uncheck the checkboxes?
Regards,
Hema
01-29-2008 9:48 AM
See the following ex:
SELECTION-SCREEN: BEGIN OF BLOCK b1.
PARAMETERS: B_all as checkbox usER-COMMAND rd1 DEFAULT 'X',
B_ONE as checkbox,
B_TWO as checkbox,
B_THR as checkbox.
SELECTION-SCREEN: END OF BLOCK b1.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF B_ALL = 'X'.
B_ONE = 'X'.
B_TWO = 'X'.
B_THR = 'X'.
MODIFY SCREEN.
ELSEIF B_ALL = ' '.
B_ONE = ''.
B_TWO = ''.
B_THR = ''.
MODIFY SCREEN.
ENDIF.
ENDLOOP.