Skip to Content

EHSM: Use Auth Check BAdI to hide Incident

Hi all,

I have enhanced the standard Auth Check BAdI BADI_EHHSS_INC_EXT_AUTH_CHECK for EHSM. Works like a charm.  But I just got another requirement and thought maybe someone else has done this before.

Right now, I have it set up so people with out the correct access can only view incidents.  Is there a way to use the BAdI to completely hide an incident when a user clicks on it?

Hope this makes sense.

Cheers,

Kevin

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Mar 18, 2015 at 08:58 PM

    Hey all,

    Our requirements ended up changing a bit but ended up putting authorization checks into class methods that control visibility for the sections of EHSM that we wanted to hide.  So, we got the result we were looking for.

    Cheers,

    Kevin

    Add comment
    10|10000 characters needed characters exceeded

    • Hey Ricky,

      Inside the BAdI Enhancement, I created an auth check method that was public so I could call it from wherever I wanted.  It returned either true or false.  For the client, it was based on the user logged in and their org id.

      As for the post-exit, there was a bunch of code the client needed, but this is what you really need.

      DATA: lo_ctrl TYPE REF TO cl_ehhss_inc_oif_cntrlr_new.
      
      FIELD-SYMBOLS: <wa> TYPE ehhsss_inc_person_involved_eso,
                                <itab> TYPE table.
      
      lo_ctrl ?= me->core_object->mo_controller.
      
      *Call auth check routine*
      
      *hide injured person in list
      ASSIGN me->core_object->mt_data->* TO <itab>.
      LOOP AT <itab> ASSIGNING <wa> CASTING.
           IF auth_routine = abap_true.
                <wa>-per_group_desc = abap_false.
                <wa>-roles_desc = abap_false.
                <wa>-roles_short_desc = abap_false.
                <wa>-full_name_disp = if_ehfnd_auth_check_c=>sc_confidential.
                <wa>-role_sort_code = abap_false.
           ENDIF.
      ENDLOOP.
      
      *hide injured person in the tab strip
      IF auth_routine = abap_true.
           lo_ctrl->mo_ui_modifier->tab_set_tabstrip_visibility( iv_visible = abap_false
                                                                                               iv_requires_own_event = abap_true ).
           me->core_object->gv_disable_delete = abap_true.
           me->core_object->gv_disable_sendinc = abap_true.
      ENDIF.
      

      On the IF statements, you may want to add additional checks.  All depends on your requirements.

      Hope this helps.

      Cheers,

      Kevin

  • avatar image
    Former Member
    Jul 19, 2016 at 07:23 AM

    Hello Kevin,

    I am new to SAP EHSM (SAP Version - 3.0)and I have the same requirement to hide some tabs or fields based on the custom access levels which has been added in domain - EHHSS_INC_ACCESS_LEVEL_CODE as suggested by SAP.

    Could you please suggest or can you please share the steps which you have done it.

    Enhanced the BADI - BADI_EHHSS_INC_EXT_AUTH_CHECK from SPRO.

    From here I am unable to proceed further.

    Thanks,

    Yerukala Setty

    Add comment
    10|10000 characters needed characters exceeded