Docking Container example in and program how include and exlude the icon
REPORT zsd_reports_docking_container MESSAGE-ID yxnmc.
TABLES: mara.
*---------------------------------------------------------------------*
* W O R K A R E A S *
*---------------------------------------------------------------------*
DATA:
* Material Data
BEGIN OF wa_mara,
matnr TYPE mara-matnr, " Material No.
mtart TYPE mara-mtart, " Material Type
bismt TYPE mara-bismt, " Old material No.
matkl TYPE mara-matkl, " Material group
meins TYPE mara-meins, " Base Unit of Measure
brgew TYPE mara-brgew, " Gross Weight
ntgew TYPE mara-ntgew, " Net Weight
gewei TYPE mara-gewei, " Weight Unit
END OF wa_mara,
* Field Catalog
wa_fieldcat TYPE lvc_s_fcat,
it_layout TYPE lvc_s_layo.
*---------------------------------------------------------------------*
* I N T E R N A L T A B L E S *
*---------------------------------------------------------------------*
DATA:
* For Material Data
t_mara LIKE STANDARD TABLE OF wa_mara,
* For Field Catalog
t_fieldcat TYPE lvc_t_fcat.
*---------------------------------------------------------------------*
* W O R K V A R I A B L E S *
*---------------------------------------------------------------------*
DATA:
* User Command
ok_code TYPE sy-ucomm,
* Reference Variable for Docking Container
r_dock_container1 TYPE REF TO cl_gui_docking_container,
* Reference Variable for alv grid
r_grid TYPE REF TO cl_gui_alv_grid.
*---------------------------------------------------------------------*
* S T A R T O F S E L E C T I O N *
*---------------------------------------------------------------------*
START-OF-SELECTION.
* To Display the Data
PERFORM display_output.
*&--------------------------------------------------------------------*
*& Form display_output *
*&--------------------------------------------------------------------*
* To Call the screen & display the output *
*---------------------------------------------------------------------*
* There are no interface parameters to be passed to this subroutine.*
*---------------------------------------------------------------------*
FORM display_output .
* To fill the Field Catalog
PERFORM fill_fieldcat USING :
'MATNR' 'T_MARA' 'Material No.',
'MTART' 'T_MARA' 'Material Type',
'BISMT' 'T_MARA' 'Old Material No.',
'MATKL' 'T_MARA' 'Material Group',
'MEINS' 'T_MARA' 'Base Unit of Measure',
'BRGEW' 'T_MARA' 'Gross Weight',
'NTGEW' 'T_MARA' 'Net Weight',
'GEWEI' 'T_MARA' 'Weight Unit'.
CALL SCREEN 500.
ENDFORM. " Display_output
*&--------------------------------------------------------------*
*& Form FILL_FIELDCAT *
*&--------------------------------------------------------------*
* To Fill the Field Catalog *
*---------------------------------------------------------------*
* Three Parameters are passed *
* pv_field TYPE any for Field *
* pv_tabname TYPE any for Table Name *
* pv_coltext TYPE any for Header Text *
*---------------------------------------------------------------*
FORM fill_fieldcat USING pv_field TYPE any
pv_tabname TYPE any
pv_coltext TYPE any .
wa_fieldcat-fieldname = pv_field.
wa_fieldcat-tabname = pv_tabname.
wa_fieldcat-coltext = pv_coltext.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " FILL_FIELDCAT
*CREATE the SCREEN 0500.
*flow logic for screen 500.
*&---------------------------------------------------------------------*
*& Module STATUS_0500 OUTPUT *
*&---------------------------------------------------------------------*
* To Set GUI Status & Title *
*----------------------------------------------------------------------*
MODULE status_0500 OUTPUT.
SET PF-STATUS 'STATUS'.
SET TITLEBAR 'TITLE'.
ENDMODULE. " STATUS_0500 OUTPUT
*&---------------------------------------------------------------------*
*& Module CREATE_OBJECTS OUTPUT *
*&---------------------------------------------------------------------*
* To Call the Docking Container & Display Method *
*----------------------------------------------------------------------*
MODULE create_objects OUTPUT.
* Create a Docking container and dock the control at right side of screen
CHECK r_dock_container1 IS INITIAL.
CREATE OBJECT r_dock_container1
EXPORTING
side = cl_gui_docking_container=>dock_at_bottom
extension = 200
caption = 'Materials'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. " IF sy-subrc <> 0.
* To Create the Grid Instance
CREATE OBJECT r_grid
EXPORTING
i_parent = r_dock_container1
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
******************************************* ecluding the icon in docking container in alv reports
DATA : p_lt_exclude TYPE ui_functions.
DATA ls_exclude TYPE ui_func.
REFRESH p_lt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
APPEND ls_exclude TO p_lt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_pc_file.
APPEND ls_exclude TO p_lt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
APPEND ls_exclude TO p_lt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
APPEND ls_exclude TO p_lt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
APPEND ls_exclude TO p_lt_exclude.
* hide detail tab in module pool programming.
ls_exclude = cl_gui_alv_grid=>mc_fc_detail.
APPEND ls_exclude TO p_lt_exclude.
* hide the graphic in module programming.
ls_exclude = cl_gui_alv_grid=>mc_fc_graph.
APPEND ls_exclude TO p_lt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy.
* hide the print module pool programmign
APPEND ls_exclude TO p_lt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_print.
APPEND ls_exclude TO p_lt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_cut.
APPEND ls_exclude TO p_lt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_loc_paste.
APPEND ls_exclude TO p_lt_exclude.
ls_exclude = cl_gui_alv_grid=>mc_fc_select_all.
APPEND ls_exclude TO p_lt_exclude.
it_layout-cwidth_opt = 'X'.
************************************************ excluding the icon in alv reports
" IF sy-subrc <> 0.
* Formatted Output Table is Sent to Control
CALL METHOD r_grid->set_table_for_first_display
EXPORTING
is_layout = it_layout
i_save = 'A'
i_default = 'X'
it_toolbar_excluding = p_lt_exclude
CHANGING
it_outtab = t_mara
it_fieldcatalog = t_fieldcat
* it_sort =
* it_filter =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. " IF sy-subrc <> 0.
ENDMODULE. " CREATE_OBJECTS OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0500 INPUT *
*&---------------------------------------------------------------------*
* To Fetch the Material Data & Refresh Table after get User Command*
*----------------------------------------------------------------------*
MODULE user_command_0500 INPUT.
CASE ok_code.
WHEN 'EXECUTE'.
SELECT matnr " material no.
mtart " material type
bismt " old material no.
matkl " material group
meins " base unit of measure
brgew " gross weight
ntgew " net weight
gewei " weight unit
FROM mara
INTO TABLE t_mara
WHERE mtart = mara-mtart.
IF sy-subrc <> 0.
ENDIF. " IF sy-subrc EQ 0.
CALL METHOD r_grid->refresh_table_display.
WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE. " CASE ok_code.
ENDMODULE. " USER_COMMAND_0500 INPUT
Comments
Post a Comment