Tuesday, 27 March 2012

Authorization Check using standard Function module

  tstca  is the table which has all the authority objects and tcodes

data:    gdf_ztcode     TYPE tstc-tcode VALUE 'ZEF0039'.

CALL FUNCTION 'AUTHORITY_CHECK_TCODE'
    EXPORTING
      tcode  = gdf_ztcode
    EXCEPTIONS
      ok     = 1
      not_ok = 2
      OTHERS = 3.
  IF sy-subrc NE 1.
    MESSAGE e022(zedm01001) WITH gdf_ztcode.
  ENDIF


Below is one more function module for  authority object

  CALL FUNCTION 'AUTHORITY_CHECK'
      EXPORTING
*   USER                         = SY-UNAME
        object                   lw_tstca-objct
        field1                   lw_tstca-field
       value1                    lw_tstca-value

     EXCEPTIONS
       user_dont_exist           1
       user_is_authorized        2
       user_not_authorized       3
       user_is_locked            4
       OTHERS                    5
    .


AGR_USERS  is the table which holds relation between User and Authorisation Roles/ Security Profiles

No comments:

Post a Comment