新建数据元素:ZDLSSX 参考数据域:ZDLSSX
有了这个两个,就可以去定义权限字段了
SU21
新建权限对象:ZSD_RC_PL
新建:权限字段:ZAUTH001
这个时候要去域ZLSSX中,将所有用到的按钮名称,加入到域中,作为KEY
以上准备工作做完后,开始CODING.
在程序开头定义全局字段:
DATA:LS_OBJECT TYPE XUOBJECT VALUE 'ZSD_CR_PL',
LS_FIELD TYPE FIELDNAME VALUE 'ZAUTH001',
LS_DOMNAME TYPE DOMNAME VALUE 'ZDLSSX'.
在PBO中检查权限字段
MODULE STATUS_9000 OUTPUT.
DATA:GT_CODE TYPE TABLE OF SY-UCOMM,
GS_CODE LIKE LINE OF GT_CODE.
REFRESH:GT_CODE.
PERFORM PRM_AUTHORIZ_CHECK TABLES GT_CODE.
SET PF-STATUS 'SD11_9000' EXCLUDING GT_CODE.
ENDMODULE.
FORM PRM_AUTHORIZ_CHECK TABLES P_LT_CODE STRUCTURE ZSDSAUTH.
DATA:LT_DD07V TYPE TABLE OF DD07V,
LS_DD07V TYPE DD07V.
CLEAR:LS_DD07V,LT_DD07V[].
SELECT * INTO CORRESPONDING FIELDS OF TABLE LT_DD07V
FROM DD07V
WHERE DOMNAME = LS_DOMNAME.
LOOP AT LT_DD07V INTO LS_DD07V.
AUTHORITY-CHECK OBJECT LS_OBJECT ID LS_FIELD FIELD LS_DD07V-DOMVALUE_L.
IF SY-SUBRC = 0.
ELSE.
APPEND LS_DD07V-DOMVALUE_L TO P_LT_CODE.
ENDIF.
ENDLOOP.
SORT P_LT_CODE BY UCOMM.
DELETE ADJACENT DUPLICATES FROM P_LT_CODE COMPARING UCOMM.
ENDFORM. " PRM_AUTHORIZ_CHECK