HIDE SOME ALV TOOL BAR USING OOPS
* HIDE SOME BUTTONS IN ALV USING OOPS.
REPORT zajay_oops_alv_demo.TABLES:zajay_zstu.
TYPES: BEGIN OF ty_stu,
zst_id TYPE zajay_zstu-zst_id,
zst_name TYPE zajay_zstu-zst_name,
zst_dept TYPE zajay_zstu-zst_dept,
zst_fee TYPE zajay_zstu-zst_fee,
END OF ty_stu.
DATA :it_stu TYPE TABLE OF ty_stu,
wa_stu TYPE ty_stu,
grid TYPE REF TO cl_gui_alv_grid,
container TYPE REF TO cl_gui_custom_container,
it_fcat TYPE lvc_t_fcat,
wa_fcat TYPE lvc_s_fcat.
DATA:t_fun TYPE ui_functions,
fs_fun TYPE ui_func.
DATA: ls_layout TYPE lvc_s_layo.
DATA :
i_events TYPE slis_t_event,
w_events LIKE LINE OF i_events.
SELECT-OPTIONS: s_id FOR wa_stu-zst_id.
START-OF-SELECTION.
PERFORM datafetch.
IF it_stu IS NOT INITIAL.
CALL SCREEN 100.
ELSEIF it_stu IS INITIAL.
MESSAGE 'data not found' TYPE 'E'.
ENDIF.
FORM datafetch.
SELECT zst_id
zst_name
zst_dept
zst_fee
FROM zajay_zstu
INTO TABLE it_stu.
ENDFORM.
MODULE status_0100 OUTPUT.
fs_fun = cl_gui_alv_grid=>mc_fc_maximum.
APPEND fs_fun TO t_fun.
fs_fun = cl_gui_alv_grid=>mc_fc_minimum.
APPEND fs_fun TO t_fun.
fs_fun = cl_gui_alv_grid=>mc_fc_subtot. " total mean value max value and min value
APPEND fs_fun TO t_fun.
fs_fun = cl_gui_alv_grid=>mc_fc_sum. "sum
APPEND fs_fun TO t_fun.
fs_fun = cl_gui_alv_grid=>mc_fg_sort. " Assending order and desending order
APPEND fs_fun TO t_fun.
fs_fun = cl_gui_alv_grid=>mc_fc_filter. " filter
APPEND fs_fun TO t_fun.
fs_fun = cl_gui_alv_grid=>mc_fc_detail. "detail
APPEND fs_fun TO t_fun.
fs_fun = cl_gui_alv_grid=>mc_fc_print. "print
APPEND fs_fun TO t_fun.
fs_fun = cl_gui_alv_grid=>mc_fc_find. "find
APPEND fs_fun TO t_fun.
fs_fun = cl_gui_alv_grid=>mc_fc_views. "views
APPEND fs_fun TO t_fun.
* ls_layout-no_toolbar = 'X'.
SET PF-STATUS 'ZPF_100'.
SET TITLEBAR 'ZTB_100'.
CREATE OBJECT container
EXPORTING
container_name = 'CUSTOM'.
CREATE OBJECT grid
EXPORTING
i_parent = container.
PERFORM zfieldcat.
CALL METHOD grid->set_table_for_first_display
EXPORTING
it_toolbar_excluding = t_fun
CHANGING
it_outtab = it_stu
it_fieldcatalog = it_fcat.
ENDMODULE.
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANCEL' .
LEAVE PROGRAM.
ENDCASE.
ENDMODULE.
FORM zfieldcat.
wa_fcat-col_pos = 1.
wa_fcat-fieldname = 'ZST_ID'.
wa_fcat-tabname = 'IT_STU'.
wa_fcat-scrtext_l = 'STUDENT ID'.
wa_fcat-outputlen = 15.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 2.
wa_fcat-fieldname = 'ZST_NAME'.
wa_fcat-tabname = 'IT_STU'.
wa_fcat-scrtext_l = 'STUDENT NAME'.
wa_fcat-outputlen = 20.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 3.
wa_fcat-fieldname = 'ZST_DEPT'.
wa_fcat-tabname = 'IT_STU'.
wa_fcat-scrtext_m = 'STUDENT DEPT'.
wa_fcat-outputlen = 12.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
wa_fcat-col_pos = 4.
wa_fcat-fieldname = 'ZST_FEE'.
wa_fcat-tabname = 'IT_STU'.
wa_fcat-scrtext_l = 'STUDENT FEE'.
wa_fcat-outputlen = 15.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
ENDFORM.
BEFORE HIDDEN
AFTER HIDDEN
Comments
Post a Comment