cancel
Showing results for 
Search instead for 
Did you mean: 

Copy "Followup" functionality on new button click

Former Member
0 Kudos

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,

Accepted Solutions (1)

Accepted Solutions (1)

kavindra_joshi
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Hi Kavindra,

I have followed the steps which you have mentioned but I have couple of questions;

How to define and instantiate  lv_order_header in your example.

BTAdminH context is not in BTDOCFLOW. How to execute it's method.

Could you please explain.

Thanks,

kavindra_joshi
Active Contributor
0 Kudos

Hi Sal ,

You can use get the BTADMINH entity from the Component Controller of the BT108H_LEA.

lv_order_header = me->comp_controller->typed_context->btadminh->get_current( ).

Once you get hold of the entity you can call the follow up method as mentioned above._c

Former Member
0 Kudos

Thanks Joshi.

But I am wrting this code in the event of BTDOCFLOW. There is no component BTadminH in btdocflow. Could you please explain a little more.

Thanks,

kavindra_joshi
Active Contributor
0 Kudos

The BTADMINH Is available in component controller of BTDOCFLOW.

~Kavindra

Former Member
0 Kudos

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.

  • The following error text was processed in the system:
    Define
    NavigationalLink NAVIGATE_CREATE for source view
    CUBTTranHistDocFlow.BTDOCFLOW/HdrWindowOVE in component BT108H_LEA.

Do I really need to do this all? If so whats the next step.?

Thanks,

kavindra_joshi
Active Contributor
0 Kudos

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

kavindra_joshi
Active Contributor
0 Kudos

Try This before you do any thing

    me->op_docflow( lr_data_collection ). instead of me->OP_NAVIGATE_CREATE( ).

~Kavindra

kavindra_joshi
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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,

kavindra_joshi
Active Contributor
0 Kudos

Hi Sal ,

Can you debug and check the difference between implementation of me->op_docflow( lr_data_collection ) and OP_NAVIGATE_CREATE. There is a parameter for e.g. Display = D , Create = C etc. Only difference is in your case the parameter value is D .

~Kavindra

kavindra_joshi
Active Contributor
0 Kudos

The Guid is hard coded in your code

lr_entity = lr_core->get_root_entity( iv_object_name = 'BTOrder'

                                        iv_object_guid = '1CC1DEEB1BFC1EE1BCC0249AF0115687').

This also could be an issue .

~Kavindra

Former Member
0 Kudos

Thanks Joshi for your help. At the end I called the other component via dynamic naviagation and everything works.

Closing the thread.

kavindra_joshi
Active Contributor
0 Kudos

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

Answers (2)

Answers (2)

Former Member
0 Kudos

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

kakshat
Advisor
Advisor
0 Kudos

Did you try specifying the FOLLOWUP event in the ON_CLICK parameter for your new button?