1.判断是否具有打印权限:
1 * 打印权限 2 AUTHORITY-CHECK OBJECT 'ZPP_AUTH' 3 ID 'ZACTVT' FIELD '07' 4 ID 'TCODE' FIELD 'ZPP007' 5 ID 'ZWERKS' DUMMY 6 ID 'ZDISPO' DUMMY 7 ID 'ZFEVOR' DUMMY. 8 IF sy-subrc = 0. 9 gv_print = 'X'. 10 ENDIF.
具有权限则将 gv_print 赋值为 ‘X’。
2.在设置状态栏时,如果没有权限则隐藏对应的按钮:
1 *----------------------------------------------------------------------* 2 FORM frm_set_status USING rt_extab TYPE slis_t_extab . 3 DATA lt_exfcode TYPE TABLE OF sy-ucomm. 4 5 * 无打印权限时隐藏打印按钮 6 IF gv_print IS INITIAL. 7 APPEND 'ZPRINT' TO lt_exfcode. 8 APPEND '&PRIN' TO lt_exfcode. 9 ENDIF. 10 11 SET PF-STATUS 'STANDARD' EXCLUDING lt_exfcode. 12 13 ENDFORM. 14 *&---------------------------------------------------------------------*
完成