SAP CRM WEBUI Dynamic Navigation to Activity Create
SAP CRM WEBUI Dynamic Navigation to Activity Create
Link: Add the following paper under
http://wiki.sdn.sap.com/wiki/display/CRM/CRM+Web+Client+UI+Framework
http://wiki.sdn.sap.com/wiki/display/CRM/CRM+Web+Client+UI+Framework
Summary: This paper illustrates how to dynamically navigate to "create activity" of transaction type '0010', using the class CL_CRM_UI_DESCRIPTOR_OBJ_SRV and the method CREATE_UI_OBJECT_BASED.
About Author: I have been working in SAP CRM for past 6 years. I am currently working for IBM India Pvt. Ltd. My Key skills are BSP, CRM technical and WEB ui.
Create a component. Create a view without any Model and value nodes.
Attach the view to the window.
Create an inbound plug for the window.
Create an interface.
Attach the window and inbound plug to the interface.
Create target links and logical links.
Add the following code in the view layout
Once you have added the link in the navigation profile of your business role.
You will get the following output.
After this is done , create an event handler of the name "create".
Add the following code in the "create" event handler.
As you can see in the code below, we are using the class CL_CRM_UI_DESCRIPTOR_OBJ_SRV and method CREATE_UI_OBJECT_BASED.
We are passing the following parameters.
OBJECT_TYPE = BT126_APPT
and OBJECT_ACTION = 'D' ********* 'D' is for create.
Also we are creating a value node, to pass the value of the transaction type.
In our example the transaction type is '0010'
In our example the transaction type is '0010'
We add the 2 entities
1) The dynamic navigation entity and
2) The value node entity to the navigation object.
Our Navigation profile needs to have the generic mapping entry shown in red.
At runtime webui picks the target id TBT110APPC and calls the inbound plug related to this target link.
Once you click on the button create now, it navigates to the Activity Creation Screen.
Following is the code witten in the event handler create.
Following is the code witten in the event handler create.
************************************************************************************
method EH_ONCREATE.
data: lr_nav_descr TYPE REF TO if_bol_bo_property_access.
data: lr_navigation TYPE REF TO if_crm_ui_navigation_service.
data: lr_col TYPE REF TO cl_crm_bol_bo_col.
data: lr_navigation TYPE REF TO if_crm_ui_navigation_service.
data: lr_col TYPE REF TO cl_crm_bol_bo_col.
data: rv_value_node TYPE REF TO cl_bsp_wd_value_node.
DATA dref TYPE REF TO data.
FIELD-SYMBOLS <ref> TYPE zprocesstype.
FIELD-SYMBOLS <ref> TYPE zprocesstype.
CREATE DATA dref TYPE zprocesstype.
ASSIGN dref->* TO <ref>.
<ref>-PROCESS_TYPE = '0010'.
CREATE OBJECT rv_value_node
EXPORTING
iv_data_ref = dref.
CALL METHOD rv_value_node->if_bol_bo_property_access~set_property
EXPORTING
iv_attr_name = 'PROCESS_TYPE'
iv_value = <ref>-PROCESS_TYPE.
ASSIGN dref->* TO <ref>.
<ref>-PROCESS_TYPE = '0010'.
CREATE OBJECT rv_value_node
EXPORTING
iv_data_ref = dref.
CALL METHOD rv_value_node->if_bol_bo_property_access~set_property
EXPORTING
iv_attr_name = 'PROCESS_TYPE'
iv_value = <ref>-PROCESS_TYPE.
cl_crm_ui_descriptor_obj_srv=>create_ui_object_based(
EXPORTING iv_ui_object_type = 'BT126_APPT'
iv_ui_object_action = 'D'
RECEIVING rr_result = lr_nav_descr ).
EXPORTING iv_ui_object_type = 'BT126_APPT'
iv_ui_object_action = 'D'
RECEIVING rr_result = lr_nav_descr ).
CHECK lr_nav_descr IS BOUND.
lr_navigation = cl_crm_ui_navigation_service=>get_instance( ).
CHECK lr_navigation IS BOUND.
CHECK lr_navigation IS BOUND.
* Check whether navigation is supported
IF lr_navigation->is_dynamic_nav_supported( lr_nav_descr ) NE abap_true.
return.
ELSE.
IF lr_navigation->is_dynamic_nav_supported( lr_nav_descr ) NE abap_true.
return.
ELSE.
CREATE OBJECT lr_col.
lr_col->if_bol_bo_col~add( iv_entity = lr_nav_descr ).
lr_col->if_bol_bo_col~add( iv_entity = lr_nav_descr ).
lr_col->if_bol_bo_col~add( iv_entity = rv_value_node ).
lr_navigation->navigate_dynamically( lr_col ).
endif.
endmethod.
************************************************************************************
Post a Comment