*Declarations
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_layout type slis_layout_alv.
constants: c_x type char1 value 'X'.
types: begin of ty_tdgt,
module_name type ztdgt_table-module_name,
program_name type ztdgt_table-program_name,
process_name type ztdgt_table-process_name,
flag type c, " TO store the flag values given in o/p checkboxes
end of ty_tdgt.
data: it_tdgt2 type standard table of ty_tdgt,
wa_tdgt2 type ty_tdgt.
*******************************************************
perform data_retrieval. "get the necessary data into our internal table
perform build_fieldcatalog.
perform display_alv_report.
******************************************************
*&--------------------------------------------------------------------*
*& Form build_fieldcatalog
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
form build_fieldcatalog.
refresh fieldcatalog.
clear fieldcatalog.
*
fieldcatalog-fieldname = 'FLAG'.
fieldcatalog-seltext_m = 'Check'.
fieldcatalog-input = 'X'.
fieldcatalog-edit = 'X'.
fieldcatalog-checkbox = 'X'.
fieldcatalog-col_pos = 1.
append fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MODULE_NAME'.
fieldcatalog-seltext_m = 'Module Name'.
fieldcatalog-input = 'X'.
fieldcatalog-col_pos = 2.
append fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PROCESS_NAME'.
fieldcatalog-seltext_m = 'Process Name'.
fieldcatalog-col_pos = 3.
fieldcatalog-outputlen = '55'.
append fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*****************************************************************
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
* Display report using ALV grid
*----------------------------------------------------------------------*
form display_alv_report .
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
* i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
* i_grid_title = 'My Title'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
tables
t_outtab = it_tdgt2[] "Internal table with data
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
write:/ sy-subrc.
endif.
endform. " DISPLAY_ALV_REPORT
***********************************************************
*PF status
*----------------------------------------------------------------------*
* FORM SET_PF_STATUS *
*----------------------------------------------------------------------*
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD_FULLSCREEN1' EXCLUDING rt_extab.
ENDFORM. "set_pf_status
****************************************************************
*User command
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
PERFORM get_userinputs USING r_ucomm "To capture the user inputs
rs_selfield.
ENDFORM.
******************************************************
*&---------------------------------------------------------------------*
*& Form GET_USERINPUTS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
* When we click on the save button the data will save in the same internal tale
* in the flag field
* To capture the output values the SY-UCOMM = '&DATA_SAVE' , than only it will *save the date
*----------------------------------------------------------------------------
form GET_USERINPUTS USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield..
CONSTANTS: l_execute(10) TYPE c VALUE '&DATA_SAVE'.
* when you check the internal table after clicking in the save button the *checkbox values were reflected in the table.
CASE r_ucomm.
WHEN l_execute . " &DATA_SAVE
REFRESH: it_prgm_details.
LOOP AT it_tdgt2 INTO wa_tdgt2 WHERE flag = c_x.
MOVE-CORRESPONDING wa_tdgt2 TO wa_prgm_details. "#EC ENHOK
APPEND wa_prgm_details TO it_prgm_details.
CLEAR: wa_prgm_details,wa_tdgt2.
ENDLOOP.
ENDCASE.
endform. " GET_USERINPUTS
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_layout type slis_layout_alv.
constants: c_x type char1 value 'X'.
types: begin of ty_tdgt,
module_name type ztdgt_table-module_name,
program_name type ztdgt_table-program_name,
process_name type ztdgt_table-process_name,
flag type c, " TO store the flag values given in o/p checkboxes
end of ty_tdgt.
data: it_tdgt2 type standard table of ty_tdgt,
wa_tdgt2 type ty_tdgt.
*******************************************************
perform data_retrieval. "get the necessary data into our internal table
perform build_fieldcatalog.
perform display_alv_report.
******************************************************
*&--------------------------------------------------------------------*
*& Form build_fieldcatalog
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
form build_fieldcatalog.
refresh fieldcatalog.
clear fieldcatalog.
*
fieldcatalog-fieldname = 'FLAG'.
fieldcatalog-seltext_m = 'Check'.
fieldcatalog-input = 'X'.
fieldcatalog-edit = 'X'.
fieldcatalog-checkbox = 'X'.
fieldcatalog-col_pos = 1.
append fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MODULE_NAME'.
fieldcatalog-seltext_m = 'Module Name'.
fieldcatalog-input = 'X'.
fieldcatalog-col_pos = 2.
append fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PROCESS_NAME'.
fieldcatalog-seltext_m = 'Process Name'.
fieldcatalog-col_pos = 3.
fieldcatalog-outputlen = '55'.
append fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*****************************************************************
*&---------------------------------------------------------------------*
*& Form DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
* Display report using ALV grid
*----------------------------------------------------------------------*
form display_alv_report .
gd_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = gd_repid
* i_callback_top_of_page = 'TOP-OF-PAGE'
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
* i_grid_title = 'My Title'
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
tables
t_outtab = it_tdgt2[] "Internal table with data
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
write:/ sy-subrc.
endif.
endform. " DISPLAY_ALV_REPORT
***********************************************************
*PF status
*----------------------------------------------------------------------*
* FORM SET_PF_STATUS *
*----------------------------------------------------------------------*
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD_FULLSCREEN1' EXCLUDING rt_extab.
ENDFORM. "set_pf_status
****************************************************************
*User command
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
PERFORM get_userinputs USING r_ucomm "To capture the user inputs
rs_selfield.
ENDFORM.
******************************************************
*&---------------------------------------------------------------------*
*& Form GET_USERINPUTS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
* When we click on the save button the data will save in the same internal tale
* in the flag field
* To capture the output values the SY-UCOMM = '&DATA_SAVE' , than only it will *save the date
*----------------------------------------------------------------------------
form GET_USERINPUTS USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield..
CONSTANTS: l_execute(10) TYPE c VALUE '&DATA_SAVE'.
* when you check the internal table after clicking in the save button the *checkbox values were reflected in the table.
CASE r_ucomm.
WHEN l_execute . " &DATA_SAVE
REFRESH: it_prgm_details.
LOOP AT it_tdgt2 INTO wa_tdgt2 WHERE flag = c_x.
MOVE-CORRESPONDING wa_tdgt2 TO wa_prgm_details. "#EC ENHOK
APPEND wa_prgm_details TO it_prgm_details.
CLEAR: wa_prgm_details,wa_tdgt2.
ENDLOOP.
ENDCASE.
endform. " GET_USERINPUTS