SAP CRM WEB UI - ONE CLICK ACTIONS

 

30d4477d-1870-4920-a160-8f8ad06e6d3b.jpg

This is a simple example for adding one click action events to a table view for bsp applications.

First, add OCA attribute to table view's context node.

Right click Attributes->Create a value attribute with the following DDIC type "CRM_THTMLB_ONE_CLICK_ACTION".

Click on images to see with original size.

After adding value attribute, go to context node class and redefine method 'GET_OCA_T_TABLE'. 

Click on images to see with original size.

Define your OCA buttons-> icons & event names in this method.

Click on images to see with original size.

After that, create GET_P method of OCA attribute with the OCA event to be triggered.

METHOD get_p_thtmlb_oca. CASE iv_property. 
  WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype. 
   rv_value = cl_bsp_dlc_view_descriptor=>field_type_oca. 
  
  WHEN if_bsp_wd_model_setter_getter=>fp_onclick. 
   rv_value = 'OCA_ACTION'. 
 
 ENDCASE. 

ENDMETHOD.

 

Create the OCA event handler, in this example "OCA_ACTION" and define actions to be done inside OCA event.

As we know event handler names are case sensitive, always try to use capitals.

Click on images to see with original size.

In this example i have written my code to delete the row on cursor's index when clicked.

METHOD eh_onoca_action. 

 DATA: lv_event TYPE string, 
       lv_index_c TYPE c LENGTH 2, 
       lv_index TYPE i. 
 
 DATA: lr_prop_acc TYPE REF TO if_bol_bo_property_access. 

 SPLIT htmlb_event_ex->event_defined AT '.' INTO lv_event lv_index_c. 
 lv_index = lv_index_c. 
 
 CHECK lv_index IS NOT INITIAL. CASE lv_event.
 
  WHEN 'DELETE'. 
   CHECK lv_index IS NOT INITIAL. 
   
   lr_prop_acc ?= typed_context->list->collection_wrapper->find( iv_index = lv_index ).
   CHECK lr_prop_acc IS BOUND. 

   typed_context->list->collection_wrapper->remove( lr_prop_acc ). 

  WHEN OTHERS. EXIT. 

 ENDCASE. 

ENDMETHOD.

 

Reminder: Do not forget to add the attribute to displayed fields on the configuration window.

Click on images to see with original size.

This is how it looks and delete button removes selected row from the collection as expexted.

Click on images to see with original size.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29810852/viewspace-1781587/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29810852/viewspace-1781587/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值