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

Re: How to Call Appointment POPUP in Items Assignement Block by click on Button

$
0
0

Hi Ravi

Thanks A lot for your reply

as per standared where we need to add this code in my component BT116IT_SRVO?

As per my requriement i implemented in BT116IT_SRVO.in this component to reach standared process

for popup window i just add below code at context node level BTADMINI,GET_OCA_T_TABLE

***************************************

* Start Of Standared Code

CALL METHOD SUPER->GET_OCA_T_TABLE

   EXPORTING

     IV_COMPONENT = IV_COMPONENT

     IV_INDEX     = IV_INDEX

   RECEIVING

     RT_ACTIONS   = RT_ACTIONS.

*End Of Standared Code

 

data: ls_one_click_action type crmt_thtmlb_one_click_action.

 

CLEAR ls_one_click_action.

ls_one_click_action-id      = 'APPOINTMENT'.

   ls_one_click_action-icon    = 'appointment.gif'.

   ls_one_click_action-text    = ''.

   ls_one_click_action-tooltip = text-001.

   ls_one_click_action-active  = 'X'.

    append ls_one_click_action to rt_actions.

******************************************************

IN The event handler i added below code

 

***********************************

DATA: lv_title              TYPE        string.

 

   DATAlr_node              TYPE REF TO CL_BSP_WD_CONTEXT_NODE,

          lr_coll_wrapper      TYPE REF TO cl_bsp_wd_collection_wrapper,

          lv_data_collection   TYPE REF TO IF_BOL_BO_COL,

          lr_wrapper           TYPE REF TO CL_BSP_WD_COLLECTION_WRAPPER.

 

   CONSTANTS: lc_cnode_name    TYPE seocmpname VALUE 'BTADMINI'.

 

lv_title = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT_SALES_ORDER/SORDER_APPNTMNTOFFER' ).

 

IF appntmnt_popup IS NOT BOUND.

     appntmnt_popup = comp_controller->window_manager->create_popup(

     iv_interface_view_name = 'BTAPPTOFFER/MainWindow'

     iv_usage_name          = 'BTApptOfferPopUp'

     iv_title               = lv_title

   ).                                                        "#EC NOTEXT

   ENDIF.

   appntmnt_popup->set_display_mode( if_bsp_wd_popup=>c_display_mode_surrounded ).

 

   CREATE OBJECT lv_data_collection TYPE  cl_crm_bol_bo_col.

   lr_coll_wrapper = typed_context->btadmini->get_collection_wrapper( ).

   lv_data_collection ?= lr_coll_wrapper->get_marked( ).

   lr_node = appntmnt_popup->get_context_node( iv_cnode_name = lc_cnode_name ).

   lr_coll_wrapper = lr_node->get_collection_wrapper( ).

   lr_coll_wrapper->set_collection( lv_data_collection ).

 

*  appntmnt_popup->set_title( lv_title ).

   appntmnt_popup->open( ).

***********************************************************

in the event handler EH_ONONE_CLICK_ACTION i added below code

**************************

CASE lv_event.

 

WHEN 'APPOINTMENT'.

         EH_ONAPPOINTMENT( htmlb_event    = htmlb_event

                   htmlb_event_ex = htmlb_event_ex ).

***********************************

in these 3 placed i implement code apart from this where i need to put the code which you suggest.

please let me know

 

i have below code in the component BT140I_SRVP

In the GET_BUTTONS

********************************************

 

   INCLUDE crm_status_con.

   INCLUDE crm_object_types_con.

 

   DATA   lr_ent     TYPE REF TO cl_crm_bol_entity.

   DATA   current    TYPE REF TO if_bol_bo_property_access.

   DATA   dref       TYPE REF TO data.

 

   DATAcoll               TYPE REF TO if_bol_entity_col.

   DATAentity             TYPE REF TO cl_crm_bol_entity,

          lr_parent_entity   TYPE REF TO cl_crm_bol_entity.

   DATAlr_node            TYPE REF TO cl_btapptof_bspwdcomponen_cn00,

          lr_coll_wrapper    TYPE REF TO cl_bsp_wd_collection_wrapper,

          lv_data_collection TYPE REF TO if_bol_bo_col,

          lr_item            TYPE REF TO cl_crm_bol_entity,

          lr_wrapper         TYPE REF TO cl_bsp_wd_collection_wrapper,

          lt_parameter       TYPE TABLE OF crm_lrp_app_gra_s.

 

   DATA: ls_button          TYPE crmt_thtmlb_button_ext,

         lv_enabled         TYPE boolean.

 

   FIELD-SYMBOLS: <fv_active> TYPE crmt_boolean.

 

   DATA: lv_guid            TYPE REF TO data,

         lv_dispo           TYPE REF TO data,

         lr_coll            TYPE REF TO if_bol_entity_col,

         lr_property_access TYPE REF TO if_bol_bo_property_access.

   DATA: lr_entity          TYPE REF TO cl_crm_bol_entity,

         lr_items           TYPE REF TO cl_crm_bol_entity,

         lr_adminh          TYPE REF TO cl_crm_bol_entity,

         lv_object_type     TYPE crmt_subobject_category_db.

 

   FIELD-SYMBOLS: <fv_guid>  TYPE crmt_object_guid,

                  <fv_dispo> TYPE crmt_srv_dispo_flg.

 

 

* check if header is incident(service request)/problem, which only support one item

   lr_entity ?= me->typed_context->btadmini->collection_wrapper->get_current( ).

   IF lr_entity IS BOUND.

     lr_items  = lr_entity->get_parent( ).

     lr_adminh = lr_items->get_parent( ).

     lr_adminh->get_property_as_value( EXPORTING iv_attr_name = 'OBJECT_TYPE'

                                       IMPORTING ev_result = lv_object_type ).

     IF lv_object_type = gc_object_type-incident

     OR lv_object_type = gc_object_type-problem.

* only DONE button (back to header-ov)

       ls_button-type     = cl_thtmlb_util=>gc_done.

       ls_button-on_click = gc_ev_done.

       ls_button-enabled  = abap_true.

       ls_button-page_id  = me->component_id.

       APPEND ls_button TO rt_buttons.

       CLEAR ls_button.

* Toolbar Divider

       ls_button-type     = cl_thtmlb_util=>gc_separator.

       ls_button-enabled  = abap_true.

       APPEND ls_button TO rt_buttons.

       CLEAR ls_button.

     ELSE.

* DONE and other general buttons

       rt_buttons = super->if_bsp_wd_toolbar_callback~get_buttons( ).

     ENDIF.

   ENDIF.

 

****

* Preview Button

   gv_print_preview_enabled = abap_true.

 

   ls_button-text     = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT/PRINT_PREVIEW' ). "#EC NOTEXT

 

   ls_button-on_click = 'PRINT_PREVIEW'.                     "#EC NOTEXT

   ls_button-page_id  = me->component_id.

   ls_button-enabled  = abap_true.

   APPEND ls_button TO rt_buttons.

   CLEAR ls_button.

 

********

 

   ls_button-enabled = abap_true.

   ls_button-on_click = 'APPNTMNT_OFFER'.

   ls_button-page_id = me->component_id.

   ls_button-text = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT_SALES_ORDER/SORDER_APPNTMNTOFFER' ).

   ls_button-tooltip = cl_wd_utilities=>get_otr_text_by_alias( 'CRM_UIU_BT_SALES_ORDER/SORDER_SCHED_APPOINTMENTS' ).

 

 

   lr_coll_wrapper = typed_context->btadmini->get_collection_wrapper( ).

   lr_item ?= lr_coll_wrapper->get_current( ).

 

 

* read parameter attribute

   CALL FUNCTION 'CRM_LRP_CUST_APP_PARAM_INFO'

     EXPORTING

       i_application     = gc_app_sbo

     TABLES

       et_app_param_info = lt_parameter.

 

   IF lt_parameter IS INITIAL.

     ls_button-enabled = abap_false.

     APPEND ls_button TO rt_buttons.

     EXIT.

   ENDIF.

 

 

 

   IF lr_item IS NOT INITIAL.

     lv_guid = lr_item->get_property( iv_attr_name = 'GUID' ).

     ASSIGN lv_guid->* TO <fv_guid>.

     IF <fv_guid> IS NOT INITIAL.

       lr_coll = lr_item->get_related_entities( iv_relation_name = 'BTItemServiceExt' ). "#EC NOTEXT

       lr_property_access = lr_coll->get_current( ).

       IF lr_property_access IS BOUND.

         lv_dispo = lr_property_access->get_property( iv_attr_name = 'DISPO_FLG' ). "#EC NOTEXT

         ASSIGN lv_dispo->* TO <fv_dispo>.

         IF <fv_dispo> IS INITIAL.

           ls_button-enabled = abap_false.

           APPEND ls_button TO rt_buttons.

           EXIT.

         ENDIF.

       ENDIF.

 

     ENDIF.

 

   ELSE.

     ls_button-enabled = abap_false.

     APPEND ls_button TO rt_buttons.

     EXIT.

   ENDIF.

 

 

 

   coll = lr_item->get_related_entities( iv_relation_name = 'BTAssignmentAll' ). "#EC NOTEXT

 

   IF coll->size( ) <> 0.

     ls_button-enabled = abap_false.

     APPEND ls_button TO rt_buttons.

     EXIT.

   ENDIF.

 

   CLEAR coll.

 

 

   TRY.

 

       coll = lr_item->get_related_entities(

                iv_relation_name = 'BTItemStatusSet' ).      "#EC NOTEXT

       current = coll->get_current( ).

       IF current IS NOT BOUND.

         ls_button-enabled = abap_false.

         APPEND ls_button TO rt_buttons.

         EXIT.

       ENDIF.

 

       entity ?= current.

       coll = entity->get_related_entities(

                iv_relation_name = 'BTStatusI_I1004' ).      "#EC NOTEXT

       current = coll->get_current( ).

       IF current IS NOT BOUND.

         ls_button-enabled = abap_false.

         APPEND ls_button TO rt_buttons.

         EXIT.

       ENDIF.

 

       TRY.

           dref = current->get_property( 'ACTIVE' ).         "#EC NOTEXT

         CATCH cx_crm_cic_parameter_error.

           ls_button-enabled = abap_false.

           APPEND ls_button TO rt_buttons.

           EXIT.

       ENDTRY.

 

 

       ASSIGN dref->* TO <fv_active>.

       IF <fv_active> = abap_false.

         ls_button-enabled = abap_false.

         APPEND ls_button TO rt_buttons.

         EXIT.

       ENDIF.

 

     CATCH cx_sy_ref_is_initial cx_sy_move_cast_error

           cx_crm_genil_model_error.

       ls_button-enabled = abap_false.

       APPEND ls_button TO rt_buttons.

       EXIT.

   ENDTRY.

 

   IF lr_item->is_changeable( ) = abap_false.

     ls_button-enabled = abap_false.

     APPEND ls_button TO rt_buttons.

     EXIT.

   ENDIF.

 

   APPEND ls_button TO rt_buttons.

************************************************

 

Thanks

Raj



Viewing all articles
Browse latest Browse all 7775

Trending Articles



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