ABAP Authorization Example 
PROCESS BEFORE OUTPUT.
 MODULE STATUS_1000.
*
PROCESS AFTER INPUT.
 MODULE USER_COMMAND_1000.
*-----------------------------------------------------------------------
*Main Menu program for Short Leave transaction
*-----------------------------------------------

*&---------------------------------------------------------------------*
*& Module pool       ZRJ000                                            *
*&---------------------------------------------------------------------*

PROGRAM  ZRJ000                                                      .
DATA: OK_CODE LIKE SY-UCOMM.
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
MODULE STATUS_1000 OUTPUT.
  SET PF-STATUS 'MAIN'.
  SET TITLEBAR 'MAIN'.

ENDMODULE.                 " STATUS_0100  OUTPUT

*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_1000 INPUT.
  CASE OK_CODE.
    WHEN 'M001'.
      CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
           EXPORTING
                ACTION    = 'S'               " Display
                VIEW_NAME = 'ZTRN'.
    WHEN 'M002'.
      PERFORM CHECK_AUTHORISATION USING 'ZRJD01'. "Display Short Leave
    WHEN 'T001'.
      PERFORM CHECK_AUTHORISATION USING 'ZRJR01'. "Delete Records of zsl_txn
    WHEN 'T002'.
      PERFORM CHECK_AUTHORISATION USING 'ZRJD02'. "Modify Records of Zsl_txn
    WHEN 'BACK' OR 'CANC' OR 'EXIT' OR 'E001'.
      SET SCREEN  0.
      LEAVE SCREEN.
  ENDCASE.

ENDMODULE.                 " USER_COMMAND_0100  INPUT


*&---------------------------------------------------------------------*
*&      Form  CHECK_AUTHORISATION
*&---------------------------------------------------------------------*
FORM CHECK_AUTHORISATION USING P_TCODE.
  AUTHORITY-CHECK OBJECT 'S_TCODE' ID 'TCD' FIELD P_TCODE.
  IF SY-SUBRC NE 0.
    MESSAGE S261(SF) WITH P_TCODE.
  ELSE.
    CALL TRANSACTION P_TCODE.
  ENDIF.
ENDFORM.                    " CHECK_AUTHORISATION
 
 
 
Serkan AKKAVAK
Computer Engineer
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com