2008 Apr 22 5:07 AM
hi,
my requirement is i have to select rows in the alv grid output and move them to the internal table.
give provide an example code for this requirement
Hi,
For your final internal table add one more field as flag.
Ex: flag TYPE c.
DATA : BEGIN OF i_zaw_pol_plan.
DATA : flag TYPE c.
INCLUDE STRUCTURE zaw_pol_plan.
DATA : END OF i_zaw_pol_plan.
DATA : ws_repid LIKE sy-repid,
gs_layout TYPE slis_layout_alv,
i_fieldcat TYPE slis_t_fieldcat_alv.
After passing the data to your final internal table and creation of field catelog..
ws_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = ws_repid
i_callback_pf_status_set = 'GUI_STAT'
i_callback_user_command = 'STAT'
is_layout = gs_layout
it_fieldcat = i_fieldcat[]
TABLES
t_outtab = i_zaw_pol_plan.
FORM stat USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
DATA selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN 'MOVE' .
LOOP AT i_zaw_pol_plan WHERE flag EQ c_x.
MOVE-CORRESPONDING i_zaw_pol_plan TO i_itab.
APPEND i_itab.
CLEAR i_itab.
ENDLOOP.
ENDCASE.
ENDFORM.
Pls. reward if useful.....
2008 Apr 22 5:19 AM
Hi,
Selecting rows means in what way??? Will check box is okay for you???
2008 Apr 22 5:30 AM
Hi,
For your final internal table add one more field as flag.
Ex: flag TYPE c.
DATA : BEGIN OF i_zaw_pol_plan.
DATA : flag TYPE c.
INCLUDE STRUCTURE zaw_pol_plan.
DATA : END OF i_zaw_pol_plan.
DATA : ws_repid LIKE sy-repid,
gs_layout TYPE slis_layout_alv,
i_fieldcat TYPE slis_t_fieldcat_alv.
After passing the data to your final internal table and creation of field catelog..
ws_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = ws_repid
i_callback_pf_status_set = 'GUI_STAT'
i_callback_user_command = 'STAT'
is_layout = gs_layout
it_fieldcat = i_fieldcat[]
TABLES
t_outtab = i_zaw_pol_plan.
FORM stat USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield.
DATA selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN 'MOVE' .
LOOP AT i_zaw_pol_plan WHERE flag EQ c_x.
MOVE-CORRESPONDING i_zaw_pol_plan TO i_itab.
APPEND i_itab.
CLEAR i_itab.
ENDLOOP.
ENDCASE.
ENDFORM.
Pls. reward if useful.....
2008 Apr 22 5:38 AM
You can di like below in the user command form of your prog.
form zf_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when 'SAVE'.
read table it_mat index rs_selfield-tabindex into wa_mat.
append wa_mat to it_mat2.
that is you just need to read your internal table that you are passing to alv from index " rs_selfield-tabindex " .
reward if helpful
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |