Well, this is a personal test play, slightly coquettish ... Please read it yourself.
1. Add the Global control attribute field to the Detail component controller:
2. Toolbar-related methods in the overview page, redefining get_buttons
METHODif_bsp_wd_toolbar_callback~get_buttons. DATA: Lv_lockTYPEabap_bool VALUE abap_true, lv_enableTYPEAbap_bool VALUE Abap_false. DATA: lr_comTYPE REF toZl_zlytest0_bspwdcompone3_impl. DATA: Rw_buttonTYPECrmt_thtmlb_button_ext. Pager METHODSuper->If_bsp_wd_toolbar_callback~get_buttons receiving Rt_buttons=rt_buttons. Lr_com?=ME-Comp_controller. CHECKLr_com isBOUND. IFLr_com->display =Abap_true. Lv_enable=Abap_false. ELSE. Lv_enable=Abap_true. ENDIF. Rw_button-TYPE= cl_thtmlb_util=>Gc_icon_save. Rw_button-on_click ='SAVE'. Rw_button-page_id =ME-component_id. Rw_button-enabled =lv_enable. APPENDRw_button tort_buttons. Rw_button-TYPE= cl_thtmlb_util=>Gc_icon_cancel. Rw_button-on_click ='CANCEL'. Rw_button-page_id =ME-component_id. Rw_button-enabled =lv_enable. APPENDRw_button tort_buttons. EndMethod.
3. Toolbar-related methods in the overview page, redefining get_number_of_visible_buttons
METHOD if_bsp_wd_toolbar_callback~get_number_of_visible_buttons. 9 . EndMethod.
The properties are defined in the implementation class of the 4.DETAIL view:
In 5.DETAIL view, redefine Do_prepare_output
DATA: Ls_buttonTYPECrmt_thtmlb_button. Pager METHODSuper->Do_prepare_output. REFRESHGt_button. CLEAR: Ls_button. Ls_button-TYPE= cl_thtmlb_util=>Gc_icon_edit. Ls_button-TEXT= Cl_wd_utilities=>get_otr_text_by_alias ('Crm_uiu_bu/edit' ). Ls_button-enabled = Abap_true."This can be controlled here as appropriateLs_button-on_click ='EDIT'. APPENDLs_button toGt_button. EndMethod.
6. Modify Detail's HTM page: Control the configuration page with local variables
<% @page language="ABAP "%><% @extension name="thtmlb "prefix=" thtmlb "%><% @extension name="chtmlb "prefix=" chtmlb "%><% @extension name="BSP "prefix=" BSP "%><%data:lv_xml TypeSTRING, Lv_displaymode typeSTRING. Lv_displaymode= controller->view_group_context->Is_view_in_display_mode (CONTROLLER). %> <thtmlb:areaframesetter toolbarbuttons ="<%= Controller->gt_button%> "Maxbuttonnumber ="4 "DisplayMode ="<%= lv_displaymode%> "/><chtmlb:config mode ="RUNTIME "DisplayMode ="<%= controller->view_display%> "/>
7. Create an event handler for detail edit
METHODEh_onedit. DATA: lr_comTYPE REF toZl_zlytest0_bspwdcompone3_impl. Lr_com?=ME-Comp_controller. CHECKLr_com isBOUND. IFLr_com->display =Abap_true. Lr_com->display =Abap_false. View_display=Abap_false. ELSE. Lr_com->display =Abap_true. View_display=Abap_true. ENDIF. EndMethod.
Okay, OK.
CRM WEB UI 04 Detail Interface Add button