07-31-2007 9:27 AM
hi all,
i am facing one problem regarding checkbox in alv.
i have to buttons on alv report as 'select all' (to select all) and 'send mail'(as i have to send mail to selected record)
wat i have done till now is:
1. when i run the report and cleck on checkboxes the action is reflected in internal table..n i can capture the data.
2.when i click on select all button all the records get selected and i can capture the data again.
now the problem :
when i clcik on "select all" and all the record get selected ..but when i deselect any of those record..the changes in internal table lost i.e. the checkbox field because empty for all the record.....
PLZ GIVE SOLUTION FOR FUNCTION "REUSE_ALV_GRID_DISPLAY" ONLY...
now the code:
************LAYOUT**************
DATA: gd_layout TYPE SLIS_LAYOUT_ALV.
gd_layout-colwidth_optimize = 'X'.
gd_layout-zebra = 'X'.
gd_layout-box_fieldname = 'CHECKBOX'.
gd_layout-box_tabname = 'IT_CONF'.
****alv display*************
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_grid_title = 'Detailed List'
it_fieldcat = fieldcat
i_callback_program = sy-repid
i_callback_user_command = 'USER_CMD'
i_callback_pf_status_set = 'EMAILS'
IS_LAYOUT = gd_layout
TABLES
t_outtab = it_conf
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endif.
endform. "alv_display
&--------------------------------------------------------------------
*& Form sush1
&----
text
----
-->RT_EXTAB text
----
FORM emails USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'EMAILS'.
ENDFORM. "emails
&----
*& Form user_cmd
&----
text
----
-->P_UCOMM text
-->LS_SELFIELDtext
----
FORM user_cmd USING p_ucomm LIKE sy-ucomm ls_selfield type slis_selfield.
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.
ENDIF.
IF p_ucomm = 'EMAIL'.
loop at it_conf where checkbox = 'X'.
**[[[[[[[U MAY NOT SEE THIS THIS IS FOR MAIL PUPOSE]]]]]]]]]]]]*********
select single sachn telnr into (tc_name , tc_num ) from t526
where SACHX = it_conf-zztc
and werks = it_conf-werks .
******find the emil of employee.
clear : p_0105,p_0105[].
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = it_conf-pernr
infty = '0105'
BEGDA = pn-begda
ENDDA = pn-endda
TABLES
infty_tab = p_0105
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
if sy-subrc = 0.
read table p_0105 with key subty = 10.
move p_0105-USRID_LONG to email.
endif.
find immediate superior by Z FM.
clear pernr_s.
CALL FUNCTION 'ZHR_GET_IMMMED_SUPERIOR'
EXPORTING
pernr = it_conf-pernr
begda = '18000101'
endda = '99991231'
IMPORTING
v_pernr = pernr_s
EXCEPTIONS
not_found = 1
OTHERS = 2.
if sy-subrc = 0.
find the email of the immed. superiors personal number..
clear : p_0105,p_0105[].
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = pernr_s
infty = '0105'
BEGDA = pn-begda
ENDDA = pn-endda
TABLES
infty_tab = p_0105
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
read table p_0105 with key subty = 10.
move p_0105-USRID_LONG to email_s.
endif.
if email <> ' '.
perform send_mail using it_conf-ename email email_s tc_name tc_num.
endif.
if email_s <> ' '.
perform send_mail using it_conf-ename email email_s tc_name tc_num.
endif.
****MAIL PART IS OVER*******************************************
endloop.
endif.
*****FOR "SELECT ALL " BUTTON**************
IF p_ucomm = 'SELECT'.
flag = 1.
loop at it_conf.
move 'X' to it_conf-checkbox.
MODIFY IT_CONF.
endloop.
ls_selfield-refresh = 'X'.
endif.
07-31-2007 10:30 AM
please see this report in th se38 which is Demo program using the ALV
' BCALV_EDIT_05
reward points if it is usefull ....
Girish
07-31-2007 9:31 AM
07-31-2007 9:47 AM
" Please see the code of myin in the 'SELECT' & 'DESELECT'.
case save_ok.
when 'EXIT'.
perform exit_program.
when 'SELECT'.
perform select_all_entries changing gt_outtab[].
when 'DESELECT'.
perform deselect_all_entries changing gt_outtab[].
when 'RESET'.
perform reset_selected_entries changing gt_outtab[].
when 'SWITCH'.
perform switch_activation changing gt_outtab[].
endcase.
form select_all_entries changing pt_outtab type standard table.
data: ls_outtab type gs_outtab.
data: l_valid type c,
l_locked type c.
*§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
* you must check the input cells.
*
* If all entries are ok, ALV transferes new values to the output
* table which you then can modify.
call method g_grid->check_changed_data
importing
e_valid = l_valid.
if l_valid eq 'X'.
loop at pt_outtab into ls_outtab.
perform check_lock using ls_outtab
changing l_locked.
if l_locked is initial
and not ls_outtab-checkbox eq '-'.
ls_outtab-checkbox = 'X'.
endif.
modify pt_outtab from ls_outtab.
endloop.
call method g_grid->refresh_table_display.
endif.
endform.
form check_lock using ps_outtab type gs_outtab
changing p_locked.
data ls_celltab type lvc_s_styl.
loop at ps_outtab-celltab into ls_celltab.
if ls_celltab-fieldname = 'CHECKBOX'.
if ls_celltab-style eq cl_gui_alv_grid=>mc_style_disabled.
p_locked = 'X'.
else.
p_locked = space.
endif.
endif.
endloop.
endform.
form deselect_all_entries changing pt_outtab type standard table.
data: ls_outtab type gs_outtab.
data: l_valid type c,
l_locked type c.
*§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
* you must check the input cells.
*
* If all entries are ok, ALV transferes new values to the output
* table which you then can modify.
call method g_grid->check_changed_data
importing
e_valid = l_valid.
if l_valid eq 'X'.
loop at pt_outtab into ls_outtab.
perform check_lock using ls_outtab
changing l_locked.
if l_locked is initial
and not ls_outtab-checkbox eq '-'.
ls_outtab-checkbox = ' '.
endif.
modify pt_outtab from ls_outtab.
endloop.
call method g_grid->refresh_table_display.
endif.
reward points if it is usefull ......
Girish
07-31-2007 10:19 AM
i dont have "deselect " button..after doing "select all" i am deselecting manually..so den its not capturing the value...
one more thing if i deselct some of the fields after "select all" (button defined by me)button triggered....and i press on standard "select all" button on standard alv toolbar..den its capturing the data..so plz help me out...
i hope u ppl got the problem!!!!!!!!!!!!!!!!
07-31-2007 12:15 PM
Hi Vivek,
You probably need to activate your "Deselect" icon on you GUI. Try using the function code <b>&SAL</b> for the Deselect button and your problem of deselecting all would be solved.
<b>Reward points if this helps,</b>
Kiran
07-31-2007 10:30 AM
please see this report in th se38 which is Demo program using the ALV
' BCALV_EDIT_05
reward points if it is usefull ....
Girish
07-31-2007 11:26 AM