Creating OCA(On Click Action) in SAP CRM WebUI

By Gokul Ragunathan, Infinite Computer Solutions

OCA – On Click Action, displays an attribute with ‘HYPERLINK’ if we implement OCA for that particular attribute. We can write logic for action to be triggered when user clicks on OCA(Hyperlinked) Attribute. In this tutorial, we will be implementing OCA for a search list attribute.  When user clicks on this attribute system will takes us to detailed overview page of selected attribute in search list

1.       Below image is snapshot of search list, in this we will be implementing OCA for ‘Description’ attribute

2.       In order to implement OCA, we need to get Component->View->Node->Attribute details. We use F2 key to get these technical details

 

3.       Once if we get Technical details using F2, go to TCode ‘BSP_WD_CMPWB’. Enter component name and click display. At left panel, open Views node in tree structure, double click on view name which we got through F2 popup. This will displays details of that particular view in right panel. In right panel open context node and in turn attribute which we got through F2

4.       In our case attribute name is ACCOUNT_DESCRIPTION. We want to implement OCA for this attribute. If we want to implement OCA we need to change field property in GET_P_  method of that particular attribute. So right click on STRUCT.ACCOUNT_DESCRIPTION and choose generate Getter_P method. This will generate GET_P(Property method) method and once if its generated, it will resemble like

 

5.       Double click on GET_P_ACCOUNT_DESCRIPTION method and implement the following code

  CASE iv_property.

    WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.

      rv_value = cl_bsp_dlc_view_descriptor=>field_type_event_link.

    WHEN if_bsp_wd_model_setter_getter=>fp_onclick.

      rv_value = 'LINKCLICK'.

  ENDCASE.  

Code in Yellow is used to change field property of attribute to OCA/Hyperlink

Code in Green is used to create an Event which has to be triggered when user clicks on this hyper link  

FYI, here we ONLY GIVE EVENT NAME, we have to create an event separately with the same name(LINKCLICK) and write logic there.  

Once these code is added, we can Save->Check->Activate this method and press F3 to get back to Component Workbench

Click here to continue...

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image