1、创建data element&domain
Tcode: SE11
Name: ZJULY_CHECK_AUTHORIT
2、创建authorization objects
Tcode: SU20
Field Name: ZJULY
Data element:ZJULY_CHECK_AUTHORIT
3、创建authorization object
Tcode: SU21
Class: ZJUL
Object: Z_JULY (July’s object class)
Field: ZJULY
4、创建ROLE
Tcode: PFCG
Role: ZJULY
在Roles’ 的Authorizations tab上,将anthorization object:z_july填入Expert Mode for Profile Generation产生的 profile 里面,自动产生profile name
5、为用户添加profile
Tcode: SU01
6、创建测试程序
DATA: Z(20) VALUE ‘abc’.
AUTHORITY-CHECK OBJECT ‘Z_JULY’
ID ‘ZJULY’ DUMMY.
WRITE:/ Z.
IF SY-SUBRC = 0.
WRITE:/ ‘PASS’.
ELSE.
WRITE:/ ‘Sorry.’.
ENDIF.
7、运行程序
必须先退出系统然后登录后前面设置的role才会生效.运行程序,结果为PASS.
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/19991.html