cancel
Showing results for 
Search instead for 
Did you mean: 

Service request search filtration based on authorization

pallavi_an
Participant
0 Kudos

Hi all,

I have a requirement to filter service request search based on authorization provided for particular user.

Suppose we have 2 types of service requests say A and B.

There are 3 agents X, Y and Z.

X has authorization for A so he should able to search only A type service requests. Similarly Y should be able to search B type and Z should be able to search both A and B types.

When i click on search button CL_CRM_SRQM_COMMON_SR_CNTRL->perform_search( ) method is getting called. How do i use to achieve my requirement? Please give some hints or if you any better approach please suggest.

CL_CRM_SRQM_COMMON_SR_CNTRL is an abstract class.

Component : SRQM_INCIDENT_S

Thanks and Regards,

Pallavi

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member188098
Active Contributor
0 Kudos

hi,

you can filter the search result according to authorization like:-

check  authorization for user.

filter search result(with filter method) with passing that type of service request parameter to filter method.

Regards,

pallavi_an
Participant
0 Kudos

Hi Harish,

Where to put this filter? This method do not have any parameters.

Thanks and Regards,

Pallavi

pallavi_an
Participant
0 Kudos

Hi Harish,


Can you please tell me whether i can use BADI CRM_ORDER_AUTH_CHECK to achieve this requirement?


Thanks and Regards,

Pallavi

former_member188098
Active Contributor
0 Kudos


Hi pallavi,

Hope you have done this requirement.

I dint had any system to do any changes, so delay in response.

i checked now, you can use filter by taking reference to below code(do changes according to u ) it working fine for filter search:-

   METHOD eh_onsearch_btn_clicked.
*CALL METHOD SUPER->EH_ONSEARCH_BTN_CLICKED
**  EXPORTING
**    htmlb_event    =
**    htmlb_event_ex =
*    .
  DATA: lv_viewname TYPE string,
        lr_view_ctrl TYPE REF TO cl_crm_srqm_common_sr_cntrl.
  lv_viewname = me->get_viewarea_content( if_crm_srqm_uiu_const=>gc_viewarea_search ).
  ASSERT lv_viewname IS NOT INITIAL.
  lr_view_ctrl ?= me->get_subcontroller_by_viewname( lv_viewname ).
  lr_view_ctrl->perform_search( ).
      DATAlr_search_result_cn     TYPE REF TO cl_bsp_wd_context_node,
          lr_sr_model TYPE REF TO cl_bsp_model,
          lr_collection TYPE REF TO cl_bsp_wd_collection_wrapper,
          lr_iterator  TYPE REF TO if_bol_bo_col_iterator,
          lr_fltr_ents TYPE REF TO if_bol_bo_property_access,
          rv_result TYPE REF TO if_bol_bo_property_access.
    CALL METHOD lr_view_ctrl->get_model
      EXPORTING
        model_id       = 'searchresult'
      RECEIVING
        model_instance = lr_sr_model.
    lr_search_result_cn ?= lr_sr_model .
    CALL METHOD lr_search_result_cn->get_collection_wrapper
      RECEIVING
        rv_result = lr_collection.
    CALL METHOD lr_collection->if_bol_bo_col~get_iterator
      RECEIVING
        rv_result = lr_iterator.
    IF lr_iterator IS BOUND.
      CALL METHOD lr_iterator->filter_by_property
        EXPORTING
          iv_attr_name = 'DESCRIPTION'
          iv_value     = 'Test Table'.
      CREATE OBJECT lr_collection.
      rv_result = lr_iterator->get_first( ).
      WHILE rv_result IS BOUND.
        CALL METHOD lr_collection->if_bol_bo_col~add
          EXPORTING
            iv_entity    = rv_result
*           iv_set_focus =   ABAP_FALSE
          .
        CALL METHOD lr_iterator->get_next
          RECEIVING
            rv_result = rv_result.
      ENDWHILE.
      lr_search_result_cn->clear_collection( ) .
      CALL METHOD lr_search_result_cn->set_collection
        EXPORTING
          collection = lr_collection.
      lr_sr_model = lr_search_result_cn .
      CALL METHOD lr_view_ctrl->set_model
        EXPORTING
          model_id       = 'searchresult'
          model_instance = lr_sr_model.
    ENDIF.
ENDMETHOD.

Regards,

pallavi_an
Participant
0 Kudos

Hi Harish,

Thanks for your response. I implemented CRM_ORDER_AUTH_CHECK badi to achieve this requirement.

Thanks and Regards,

Pallavi