Creating A Custom View in A Overview Page
Creating A Custom View in A Overview Page
overview page:
Go to component workbench.
T CODE BSP_WD_CMPWB
select 'form view' and check 'configurable ' (Here, Screenshot is different one)
save it.
controller , context and context node classes will be generated.
our view in component structure browser will look like this.
No 'RT
Rep
Details of
View '
The view 'zempview' is not assigned to any view set or overviewpage. So, 'RT Rep
details of view' is not displayed here.
so we should add this view to overview page or viewset in runtime repository. In this
case opportunityOVViewset is the overviewpage name. So adding our view to view
area which is resided in
opportunityOVViewset.
Adding view in back end is completed. But it is not visible in web ui.
We should save the view. Now, open webUI and click on configure page. A window
will be opened.
Move our 'zempview' from left to right side. i.e Available Assignment blocks to
displayed assignment blocks. By clicking up and down buttons we can manage to
place the view in desired position.
save & close.
Now open component workbench , open our view and click on configuration tab.
Add fields from available to display byclicking '+' button.
save it.
Note: if you dont perform this step, you would get 'NO_CONFIG_FOUND' error in
webUI.
View will be displayed on the webUI.
clear ls_button.
REFRESH gt_toolbar_buttons." gt_toolbar_buttons is an attribute of type CRM
T_THTMLB_BUTTON_T in the _IMPL Class.
ls_button-id = 'Insert'.
ls_button-text = 'Insert'.
ls_button-on_click = 'Insert'.
ls_button-tooltip = 'Insert'.
ls_button-enabled = abap_true.
APPEND ls_button to gt_toolbar_buttons.
clear ls_button.
ls_button-id = 'Delete'.
ls_button-text = 'Delete'.
ls_button-on_click = 'Delete'.
ls_button-type = cl_thtmlb_util=>gc_icon_delete.
ls_button-tooltip = 'Delete'.
ls_button-enabled = abap_true.
APPEND ls_button to gt_toolbar_buttons.
clear ls_button.
ls_button-id = 'Edit'.
ls_button-text = 'Edit'.
ls_button-on_click = 'Edit'.
ls_button-type = cl_thtmlb_util=>gc_icon_edit.
ls_button-tooltip = 'Edit'.
ls_button-enabled = me->view_group_context->is_view_in_display_mode( me ).
APPEND ls_button to gt_toolbar_buttons.
endmethod.
*********************************************************************************
****
Just we have added 'insert','delete' & 'edit' buttons, but they dont perform
any action if you click on them. For that we need to create Event handlers for
buttons to be performed.
Edit Button : (EH_ONEDIT):
**************************************************************************
****
method EH_ONEDIT.
data: lr_entity type ref to cl_crm_bol_entity,
lr_cuco type ref to CL_BT111H_O_OPPTDETAILSCU_IMPL. " BTADMINH (objec
*****************************************************************************
Insert Button: (EH_ONINSERT)
*****************************************************************************
method EH_ONINSERT.
data: lr_value type ref to cl_bsp_wd_value_node,
lr_coll type ref to cl_bsp_wd_collection_wrapper.
" if_bol_bo_col
endmethod.
**************************************************************************
***
New row will be inserted in the table view zemployeeview.
DELETE BUTTON: (EH_ONDELETE):
*********************************************************************************
****
method EH_ONDELETE.
data: lr_entity type ref to cl_bsp_wd_value_node,"entity
ref from value node
lr_coll type ref to if_bol_bo_col," for the collection of collection
wrapper
lr_marked_coll type ref to if_bol_bo_col.
" for the marked collect
ion of collection wrapper
*************************************************************************************
SAVE METHOD: ( Of Overview page) :
Before proceeding to the coding part, we need to create custom controller 'zcuco'
and do create binding for the 'zemptable'.
By right clicking on custom controllers in component structure browser , we can
create cuco by the help of wizard.
After creating 'zcuco', we should create binding on the context node of zemptable.
After successful binding, the structure look like below.
Code for SAVE method should be written in the SAVE event handler of opportunity
overview page.
create event handler -SAVE and write the below code in that method.
lr_modal_entity ?= me->ztyped_context->btadminh->collection_wrapper>get_current( ).
lv_id = lr_modal_entity->get_property_as_string( iv_attr_name = 'OBJECT_ID'
).
lv_guid = lr_modal_entity->get_property_as_string( iv_attr_name = 'GUID' ).
lr_cuco ?= me->get_custom_controller( controller_id = 'ZBT111H/zcuco' ).
lr_coll ?= lr_cuco->typed_context->zemptable->collection_wrapper.
check lr_coll is bound.
lr_iterator ?= lr_coll->get_iterator( ).
lr_value_entity ?= lr_iterator->get_first( ).
while lr_value_entity is bound.
CALL METHOD LR_VALUE_ENTITY->GET_PROPERTIES
IMPORTING
ES_ATTRIBUTES = ls_emp.
ls_emp-z_id = lv_id.
ls_emp-z_guid = lv_guid.
* ls_emp = lr_value_entity->if_bol_bo_property_access~get_properties( ).
append ls_emp to lt_emp.
insert zemp from table lt_emp ACCEPTING DUPLICATE KEYS.
lr_value_entity ?= lr_iterator->get_next( ).
endwhile.
endmethod.