2013 Jul 28 12:12 PM
well, it seems I didn't find the materials required to accomplish or complete my program.
I've created a screen holding a custom control to show table which i have done it successfully but how to show checkboxes for each record or line and reuse the selected lines on the same custom control when pressing a push-button?
I would be thankful if i get your recommendations.
2013 Jul 28 4:30 PM
Hi,
Add checkbox to fieldcatalog.
code after CALL METHOD alv_grid1->set_table_for_first_display.
CALL METHOD alv_grid1->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified
EXCEPTIONS
error = 1
OTHERS = 2.
Then add this code in DISPLAY button case.
WHEN 'DISPLAY'.
* CALL METHOD alv_grid1->get_selected_rows
* IMPORTING
* et_row_no = it_rows[].
*
* LOOP AT it_rows INTO wa_rows.
*
* READ TABLE it_mara INTO wa_mara INDEX wa_rows-row_id.
*
* IF sy-subrc = 0.
* SELECT SINGLE matnr werks dismm FROM marc INTO wa_marc
* WHERE matnr = wa_mara-matnr.
* IF sy-subrc = 0.
* APPEND wa_marc TO it_marc.
* CLEAR wa_marc.
* ENDIF.
* ENDIF.
* ENDLOOP.
LOOP AT it_mara INTO wa_mara WHERE check EQ 'X'.
SELECT SINGLE matnr werks dismm FROM marc INTO wa_marc
WHERE matnr = wa_mara-matnr.
IF sy-subrc = 0.
APPEND wa_marc TO it_marc.
CLEAR wa_marc.
ENDIF.
ENDLOOP.
IF it_marc IS INITIAL.
MESSAGE 'THERE IS NO PLANT RECORDS AVAILABLE FOR THE MATERIAL' TYPE 'E'.
ENDIF.
CALL METHOD alv_grid2->refresh_table_display.
Srikanth.
Hi,
Add checkbox to fieldcatalog.
code after CALL METHOD alv_grid1->set_table_for_first_display.
CALL METHOD alv_grid1->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified
EXCEPTIONS
error = 1
OTHERS = 2.
Then add this code in DISPLAY button case.
WHEN 'DISPLAY'.
* CALL METHOD alv_grid1->get_selected_rows
* IMPORTING
* et_row_no = it_rows[].
*
* LOOP AT it_rows INTO wa_rows.
*
* READ TABLE it_mara INTO wa_mara INDEX wa_rows-row_id.
*
* IF sy-subrc = 0.
* SELECT SINGLE matnr werks dismm FROM marc INTO wa_marc
* WHERE matnr = wa_mara-matnr.
* IF sy-subrc = 0.
* APPEND wa_marc TO it_marc.
* CLEAR wa_marc.
* ENDIF.
* ENDIF.
* ENDLOOP.
LOOP AT it_mara INTO wa_mara WHERE check EQ 'X'.
SELECT SINGLE matnr werks dismm FROM marc INTO wa_marc
WHERE matnr = wa_mara-matnr.
IF sy-subrc = 0.
APPEND wa_marc TO it_marc.
CLEAR wa_marc.
ENDIF.
ENDLOOP.
IF it_marc IS INITIAL.
MESSAGE 'THERE IS NO PLANT RECORDS AVAILABLE FOR THE MATERIAL' TYPE 'E'.
ENDIF.
CALL METHOD alv_grid2->refresh_table_display.
Srikanth.
2013 Jul 28 4:30 PM
Hi,
Add checkbox to fieldcatalog.
code after CALL METHOD alv_grid1->set_table_for_first_display.
CALL METHOD alv_grid1->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified
EXCEPTIONS
error = 1
OTHERS = 2.
Then add this code in DISPLAY button case.
WHEN 'DISPLAY'.
* CALL METHOD alv_grid1->get_selected_rows
* IMPORTING
* et_row_no = it_rows[].
*
* LOOP AT it_rows INTO wa_rows.
*
* READ TABLE it_mara INTO wa_mara INDEX wa_rows-row_id.
*
* IF sy-subrc = 0.
* SELECT SINGLE matnr werks dismm FROM marc INTO wa_marc
* WHERE matnr = wa_mara-matnr.
* IF sy-subrc = 0.
* APPEND wa_marc TO it_marc.
* CLEAR wa_marc.
* ENDIF.
* ENDIF.
* ENDLOOP.
LOOP AT it_mara INTO wa_mara WHERE check EQ 'X'.
SELECT SINGLE matnr werks dismm FROM marc INTO wa_marc
WHERE matnr = wa_mara-matnr.
IF sy-subrc = 0.
APPEND wa_marc TO it_marc.
CLEAR wa_marc.
ENDIF.
ENDLOOP.
IF it_marc IS INITIAL.
MESSAGE 'THERE IS NO PLANT RECORDS AVAILABLE FOR THE MATERIAL' TYPE 'E'.
ENDIF.
CALL METHOD alv_grid2->refresh_table_display.
Srikanth.
2013 Jul 28 6:12 PM
2013 Jul 28 8:28 PM
Hi,
First declare the first field in your catalog as a check box.
CLEAR gs_fcat.
gs_fcat-fieldname = 'CHECKBOX'.
gs_fcat-seltext_m = 'Select'.
gs_fcat-checkbox = 'X'.
gs_fcat-edit = 'X'.
gs_fcat-input = 'X'.
APPEND gs_fcat TO gt_fcat.
Second, in the user command module, capture the button press event, save the edited grid and do the required coding.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gv_repid
i_callback_user_command = 'USER_COMMAND'
is_layout = gs_layout
it_fieldcat = gt_fcat
TABLES
t_outtab = gt_data .
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
case r_ucomm.
when 'FCODE'.
* Save the data edited in the grid.
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_data into wa_data.
if checkbox = 'X'.
perform coding.
endif.
endcase.
RS_SELFIELD-REFRESH = 'X'.
endform.
2013 Aug 03 5:39 PM
thank you all for helping i gotta try them n apply the fittest one for the program i'm building
thank u soooo much
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |