点击此处---> 群内免费提供SAP练习系统(在群公告中)
加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)
In your editor program, click Goto -> Attributes
Key in the authorization in the Authorization Group.
------------------------------------------------------------------------------------------------
ABAP Authorization Example by: Rajiv Ranjan Singh
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