2007 Jul 27 12:25 PM
Hello everyone,
I'm using FM "REUSE_ALV..." to display an ALV grid. I added a column checkbox, that i need for processing the chosen lines that are checked. The problem is when i click on the button designed to do that processing, the internal table still comes with checkbox fields empty.
I searched through the forum and i know that if i use the "save" button (sy-ucomm = "&DATA_SAVE") the internal table is immediatly refreshed with the new values for the checkboxes, but the same doesn´t happen to other buttons. There's a way: double-clicking, the ALV refreshes and the corresponding internal table refreshes with it.
But i don't want the user to double-click and then click "process" button. It should be unnecessary to do that.
How can i solve the problem ? How can i get the filled checkboxes immediatly in the internal table, in the form USER-COMMAND i have to control sy-ucomm.
Here is a sample of what i have till now:
Internal Table:
DATA: BEGIN OF gs_outtab,
sel(1), "Checkbox
bukrs LIKE ztable01-bukrs, "Company
butxt LIKE t001-butxt, "Company Name
(...)
DATA: END OF gs_outtab.
DATA: gt_outtab LIKE gs_outtab OCCURS 0 WITH HEADER LINE.
Fieldcatalog:
FORM fieldcat_init USING rt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
Field Catalog
CLEAR ls_fieldcat.
pos = pos + 1.
ls_fieldcat-col_pos = pos.
ls_fieldcat-fieldname = 'SEL'.
ls_fieldcat-tabname = 'GT_OUTTAB'.
ls_fieldcat-checkbox = 'X'.
ls_fieldcat-emphasize = 'X'.
ls_fieldcat-edit = 'X'.
ls_fieldcat-outputlen = '6'.
APPEND ls_fieldcat TO rt_fieldcat.
User-command:
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: idx TYPE i.
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
CLEAR gt_outtab.
READ TABLE gt_outtab INDEX rs_selfield-tabindex.
CLEAR tab_index.
tab_index = rs_selfield-tabindex.
IF r_ucomm = '&IC1'.
CASE rs_selfield-fieldname.
WHEN 'LIFNR'.
SET PARAMETER ID 'LIF' FIELD gt_outtab-lifnr.
SET PARAMETER ID 'BUK' FIELD gt_outtab-bukrs.
CALL TRANSACTION 'FK03'.
ENDCASE.
ELSEIF r_ucomm = '&LANC'.
LOOP AT gt_outtab WHERE NOT sel IS INITIAL. <--- The program neves catches this condition
ENDLOOP.
ENDIF.
2007 Jul 27 12:52 PM
Data: ref1 type ref to cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = ref1.
call method ref1->check_changed_data.
loop at gt_output where sel = 'X'.
.....
......
.....
endloop.
2007 Jul 27 12:52 PM
Data: ref1 type ref to cl_gui_alv_grid.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = ref1.
call method ref1->check_changed_data.
loop at gt_output where sel = 'X'.
.....
......
.....
endloop.
2007 Jul 27 12:57 PM
Hi,
Change the user command lines
User-command:
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
data p_ref1 type ref to cl_gui_alv_grid. " Check these lines
call function 'GET_GLOBALS_FROM_SLVC_FULLSCR' "
importing "
e_grid = p_ref1. "
call method p_ref1->check_changed_data. "
DATA: idx TYPE i.
rs_selfield-refresh = 'X'.
rs_selfield-col_stable = 'X'.
rs_selfield-row_stable = 'X'.
CLEAR gt_outtab.
READ TABLE gt_outtab INDEX rs_selfield-tabindex.
CLEAR tab_index.
tab_index = rs_selfield-tabindex.
IF r_ucomm = '&IC1'.
CASE rs_selfield-fieldname.
WHEN 'LIFNR'.
SET PARAMETER ID 'LIF' FIELD gt_outtab-lifnr.
SET PARAMETER ID 'BUK' FIELD gt_outtab-bukrs.
CALL TRANSACTION 'FK03'.
ENDCASE.
ELSEIF r_ucomm = '&LANC'.
LOOP AT gt_outtab WHERE NOT sel IS INITIAL. <--- The program neves catches this condition
ENDLOOP.
ENDIF.
aRs
2007 Jul 27 1:02 PM
I think you forgot to fill these two field in ALV Layout
slis_layout_alv-box_fieldname
slis_layout_alv-box_tabname
fill them with fieldname of checkbox and internal table name
2007 Jul 27 1:47 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |