on 07-02-2013 8:22 PM
Hi,
I am working on leads component. Component name is BT108H_LEA. There is a view LeadOVViewSet. There is a event EH_ONFOLLOWUP. Please see the screenshot below.
Now our requirement is to trigger the same Follow up functionality on another custom button on "Transaction History" Assignment block. Please see the below image.
I know how to create a button here. But how to call above Follow up functionality on this button click.
Thanks,
Hi Sal ,
This could be achieved. You need to define
a) Button
b) Event Handler for the button
c) Calling the method for followup
d) The following code needs to be invoked from Event Handler to ensure copy functionality
* Execute entity method
DATA: lv_items TYPE REF TO cl_crm_bol_entity.
lv_items->execute( iv_method_name = ‘RenumberItems’ ).
* ... with input parameters and a list of BOL entities
returned
DATA: ls_param TYPE crmt_name_value_pair,
lt_param TYPE crmt_name_value_pair_tab,
lv_result TYPE REF TO if_bol_entity_col.
ls_param-name = ‘PROCESS_TYPE’.
ls_param-value = ‘TSRV’.2 Basic Features of the BOL Application Programming Interface
append ls_param to lt_param.
TRY.
lv_result = lv_order_header->execute( iv_method_name =
‘createFollowUp’
it_param = lt_param ).
* Error handling
CATCH CX_CRM_BOL_METH_EXEC_FAILED.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I did what you said but it's not calling the Follow up screen. So I went to "Create Followup" code and I think just calling the execute method is not sufficent. So copied the below code from follow up event handler method.
DATA: lr_core TYPE REF TO cl_crm_bol_core,
lr_result TYPE REF TO if_bol_entity_col,
lr_order TYPE REF TO cl_crm_bol_entity,
lr_access TYPE REF TO if_crm_uiu_bt_channel_aspects,
lr_collection TYPE REF TO if_bol_bo_col,
lv_header_guid TYPE crmt_object_guid,
lv_object_id TYPE crmt_object_id,
lv_object_type TYPE swo_objtyp,
* lv_result TYPE crmt_boolean,
lv_exit TYPE abap_bool.
* get the Order entity
lr_core = cl_crm_bol_core=>get_instance( ).
lr_entity = lr_core->get_root_entity( iv_object_name = 'BTOrder'
iv_object_guid = '1CC1DEEB1BFC1EE1BCC0249AF0115687').
CHECK lr_entity IS BOUND.
* get the AdminH entity
TRY.
CALL METHOD lr_entity->get_related_entity
EXPORTING
iv_relation_name = 'BTOrderHeader' "#EC NOTEXT
RECEIVING
rv_result = lr_entity.
CATCH cx_crm_genil_model_error .
ENDTRY.
TRY.
* Execute createFollowUp-Method in order to create a new one order document for the selected template
lr_result = lr_entity->execute( iv_method_name = 'createFollowUp' "#EC NOTEXT
it_param = lt_param ).
CATCH: cx_crm_genil_model_error cx_crm_bol_meth_exec_failed.
RETURN.
ENDTRY.
CHECK lr_result IS BOUND.
* Get the new BTOrder-Entity
lr_order ?= lr_result->get_current( ).
CHECK lr_order IS BOUND.
* Navigation
CREATE OBJECT lr_collection TYPE cl_crm_bol_bo_col.
CHECK lr_collection IS BOUND.
lr_collection->add( lr_order ).
op_navigate_create( lr_collection ).
Then I got the short dump.
Do I really need to do this all? If so whats the next step.?
Thanks,
Hi Sal ,
Your creation step is done. Now you now have to navigate to the follow-up screen.And you don't have Navigation link which the OP_NAVIGATE_CREATE would try to follow.
The error mentions that you have not created Navigational Link for navigating from BTDOCFLOW to followup screen.
Can you create a navigational link (in RunTime Repository) , similar to navigational link present in the component from where you have copied the code ?
Or else you can use the Navigation code ( Sourced from @Ashishwalke's Navigation guide )
This is the code you have to write to Navigate
a) Get instance of the BOL core and Activity root object.(This is done for Activity , you have to do the same for Lead )
lr_core = cl_crm_bol_core=>get_instance( ).
lr_activity = lr_core->get_root_entity( iv_object_name = 'BTOrder'
iv_object_guid = lv_activity_guid ).
CHECK lr_activity IS BOUND.
Assumption:- Activity GUID has been fetched in variable “lv_activity_guid”
b) Create an object for navigation.
CREATE OBJECT lr_coll_for_navigate TYPE cl_crm_bol_bo_col.
c) Add the Activity entity to the navigation collection.
lr_coll_for_navigate->add( iv_entity = lr_activity
iv_set_focus = abap_true ).
d) Get Activity object type.
lv_object_type = cl_crm_uiu_ibase_tool=>get_bt_ui_object_type( lr_activity ).
Assumption:- The BOL entity for Activity has already been fetched in variable “lr_activity”
e) Create the navigation descriptor.
cl_crm_ui_descriptor_obj_srv=>create_ui_object_based(
EXPORTING iv_ui_object_type = lv_object_type
iv_ui_object_action = lc_action
RECEIVING rr_result = lr_nav_descr ).
CHECK lr_nav_descr IS NOT INITIAL.
f) Insert the navigation descriptor in navigation collection at position 1.
lr_coll_for_navigate->insert( iv_bo = lr_nav_descr
iv_index = 1 ).
g) Register the current page in history so that we can navigate back to it.
RAISE EVENT history_trigger .
h) Call outbound plug for navigation and pass the navigation collection.
op_toactivity( lr_coll_for_navigate ).
i) Get instance of the navigation service and navigate to the component dynamically along with collection.
DATA: lr_nav_serv TYPE REF TO if_crm_ui_navigation_service.
lr_nav_serv = cl_crm_ui_navigation_service=>get_instance( ).
lr_nav_serv->navigate_dynamically( iv_data_collection = iv_data_collection ).
~Kavindra
Hi Sal ,
Check this also http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=180356294&bc=true. In this case the code is there. In your case you just have to call the standard UI Object type which you can find from the customizing .
~Kavindra
Thanks Joshi.
me->op_docflow( lr_data_collection ).
I used this statement instead of other, and now it's working.
The only probelm is - it opens the follow up screen in DISPLAY MODE. Our requirement is to open in EDIT mode.
Any idea how to do that?
Fyi.
Standard followup functionality opens in EDIT mode.
Thanks,
Hi Sal ,
Please do like this as well http://scn.sap.com/docs/DOC-27478. This is the source from where I copied the code
~Kavindra
Hi Sal
You can do like this..
1.Create an event for your custom followup button in the Overview page(BT108H_LEA/LeadOVViewSet)
2.Try to call the the follow up event of the standard "Transaction history " AB.
Hope it should the have name as "CUBTTranHistDocFlow.MainWindow" in Overview.
Try to get the subcontroller of the Transaction history and trigger that standard event.
Ex:
lr_viewset TYPE REF TO cl_bsp_wd_view_controller.
lr_viewset ?= lr_window->get_subcontroller_by_viewname( 'SCUBTTranHistDocFlow.MainWindow' ).
Regards
Logu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you try specifying the FOLLOWUP event in the ON_CLICK parameter for your new button?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.