Quantcast
Channel: SCN: Message List - SAP CRM: Webclient UI - Framework
Viewing all articles
Browse latest Browse all 7775

Re: Adding 'Create' button on the Assignment block of the Overview Page

$
0
0

Hi Dev,

 

the same requirement you can observe in standard assignment block in corporate Account.

 

i will give you guidance how to create button and how to navigate from one component to another.

 

creating button:

 

Create toolbar button we have to declare attribute type crmt_thtmlb_button_t in impl class.

 

button.JPG

write the logic in do_prepare_output.

DATA: ls_button            TYPE crmt_thtmlb_button.


REFRESH : gt_view_button.

  ls_button-id = 'NAVIGATE_TO_TARGET'.
ls_button
-on_click = 'NEW'.
ls_button
-text = 'New'.
ls_button
-enabled = 'X'.

ls_button-type     = cl_thtmlb_util=>gc_icon_new.
APPEND ls_button TO gt_view_button.
CLEAR ls_button.
ENDMETHOD.



then go to .htm change like this


in  actions field provide like this "<=% controller->gt_view_button %>"

button.JPG

then you can see the button in your account ov.


now the task is when you click on that button you need to open create contract page.

so first of all you have to identify the component name of create contract. if you want to use one component in other component then you should define component usag.


calling create contract view.


when new button click one event gets generated so create one event.

on your account block.



write the logic like this.


1.first to get the account over view context node and lock that entity.

2.then create your create contract relation using create_related_entity.

3.then get the entity of your(contract view cnode) context node info.

4. add entity info to your context node.

5. get the component controller instance because when ever your are enter any info into contract view that field info will available in other component.

here we are navigating from one view to other view.


DATA: lr_window      TYPE REF TO cl_bsp_wd_window,

         lr_entity      TYPE REF TO cl_crm_bol_entity,

         lr_current     TYPE REF TO cl_crm_bol_entity,

         lv_collection  TYPE REF TO cl_bsp_wd_collection_wrapper,

*        lv_index       TYPE int4,

         lr_col         TYPE REF TO if_bol_bo_col,

         lr_coco        TYPE REF TO cl_bp_addr_bspwdcomponent_impl,

         lv_addr_time_dependant TYPE bu_development_active,

         lv_date_from   TYPE bu_datfrom,

         lv_date_to     TYPE bu_datto.


"1. step

* lock current business partner

   lr_entity ?= typed_context->accont contextnode->collection_wrapper->get_current( ).

   IF lr_entity->lock( ) = abap_true.

     TRY.

"2nd step

         lr_entity = lr_entity->create_related_entity(

          iv_relation_name = 'contract rel name' ).

       CATCH cx_crm_genil_model_error cx_crm_genil_duplicate_rel.

*               should never happen

     ENDTRY.


"4th step

      typed_context->contract cnode->collection_wrapper->add( iv_entity = lr_entity

                                                            iv_set_focus = abap_true ).

"5th step

*     Add & set focus at component controller

       lr_coco ?= me->comp_controller.

       lr_coco->typed_context->address->collection_wrapper->add(

                               iv_entity = lr_entity

                               iv_set_focus = abap_true ).


       lr_coco->typed_context->address->collection_wrapper->find( iv_bo = lr_entity ).


"6th step.

navigation get the window instance

*      RAISE EVENT history_trigger.

       lr_window = me->view_manager->get_window_controller( ).

 

       CREATE OBJECT lv_collection.

       lv_collection->add( iv_entity = lr_entity

                           iv_set_focus = abap_true ).

       lr_window->call_outbound_plug( iv_outbound_plug = 'outbound plug name'

                                      iv_data_collection = lv_collection ).


go through this doc.


WebUI Navigation guide


if you want to know more about how to navigate then go to BP_ADDR/CorpAccountAddressesOV in that there an event EH_ONNEW . observe that then you can come to know..


Thanks & Regards,

Srinivas.


Viewing all articles
Browse latest Browse all 7775

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>